Beispiel #1
0
 public static FileMessageInfo Create(string serverHttpUrl)
 {
     var webClient = new WebClientV2();
     webClient.BaseAddress = serverHttpUrl;
     webClient.Credentials = CredentialCache.DefaultCredentials;
     return new FileMessageInfo()
     {
         Client = webClient,
         Status = 0
     };
 }
Beispiel #2
0
        private static void TestFileUpload()
        {
            WebClientV2 wb = new WebClientV2();
            string      aa = Console.ReadLine();

            wb.UploadProgressChanged += wb_UploadProgressChanged;
            wb.UploadFileCompleted   += wb_UploadFileCompleted;
            while (aa != "q")
            {
                FileInfo info = new FileInfo(aa);
                Console.WriteLine("Size:" + info.Length);
                wb.UploadFileAsync(new Uri("http://localhost:46916/upload"), aa);
                Thread.Sleep(5000);
                aa = Console.ReadLine();
            }
        }