zoukankan      html  css  js  c++  java
  • 网络通信

                //DownloadProgressChanged

                //DownloadStringCompleted 

                //OpenReadCompleted

                //OpenWriteCompleted

                 //UploadProgressChanged

                 //UploadStringCompleted

                 //  WriteStreamClosed

     

               // DownLoadStringAsnc

                //OpenReadAsync

                //UpLoadStringAsync

                //OpenWriteAsync

                WebClient client = new WebClient();

                if (client.IsBusy)

                    client.CancelAsync();

                client.OpenReadCompleted+=new OpenReadCompletedEventHandler(client_OpenReadCompleted);

                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);

                client.OpenReadAsync(new Uri("path"));

     

            }

            private void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)

            {

                BitmapImage bitmap = new BitmapImage();

                bitmap.SetSource(e.Result);

                Image1.Source = bitmap;

             

            }

            private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)

            {

                int percent = e.ProgressPercentage;

                long recieve = e.BytesReceived;

                long total = e.TotalBytesToReceive;

     

            }

  • 相关阅读:
    centos免密码登录
    conda3 快速下载python包
    Flink问题及解决方案
    git把项目推送到不同的remote(git地址)
    选择器提取内容
    spark写入mysql
    flume简介及netcat样例
    Spark 读取 Hbase 优化 --手动划分 region 提高并行数
    shell grep正则表达式
    Hibernate持久化
  • 原文地址:https://www.cnblogs.com/lifeOfIT/p/2528875.html
Copyright © 2011-2022 走看看