Esempio n. 1
0
 void ClearClient()
 {
     _client.DownloadProgressChanged -= OnDownloadProgressChanged;
     _client.DownloadFileCompleted   -= OnDownloadFileCompleted;
     _client.Dispose();
     _client = null;
 }
Esempio n. 2
0
 /// <summary>
 /// 销毁对象,会停止所有的下载
 /// </summary>
 public void Dispose()
 {
     if (_client != null)
     {
         _client.DownloadProgressChanged -= OnDownloadProgressChanged;
         _client.DownloadFileCompleted   -= OnDownloadFileCompleted;
         _client.CancelAsync();
         _client.Dispose();
         _client = null;
         if (false == _isDone)
         {
             SetError("Canceled");
             _isDone = true;
         }
     }
 }