Пример #1
0
        public static void DownloadDataInBackground(long blobID, string blobUrl)
        {
            System.Threading.AutoResetEvent waiter = new System.Threading.AutoResetEvent(false);

            BlobWebClient client = new BlobWebClient();
            client.BlobID = blobID;
            client.BlobUrl = blobUrl;
            //client.BlobChecksum = blobChecksum;
            //client.BlobChecksumAlgorithm = blobChecksumAlgorithm;

            Uri uri = new Uri(blobUrl);

            client.DownloadDataCompleted += new System.Net.DownloadDataCompletedEventHandler(client_DownloadDataCompleted);
            client.DownloadProgressChanged += new System.Net.DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
            downloadClients.Add(blobID, client);

            client.DownloadDataAsync(uri, waiter);

            //waiter.WaitOne();
        }
Пример #2
0
 static void RetryDownload(BlobWebClient client)
 {
     if (client.ErrorCount > 2)
     {
         downloadClients.Remove(client.BlobID);
         throw new System.Net.WebException("BlobID: " + client.BlobID + " at URL: " + client.BlobUrl
             + " Download Error errorCount = " + client.ErrorCount);
     }
     else
     {
         Uri uri = new Uri(client.BlobUrl);
         System.Threading.AutoResetEvent waiter = new System.Threading.AutoResetEvent(false);
         client.DownloadDataAsync(uri, waiter);
     }
 }