private void DownloadComplete(object sender, RunWorkerCompletedEventArgs e) { MemoryStream stream = null; RunWorkerCompletedEventArgs eventArgs = e; try { if (e.Cancelled == false && e.Error == null) { if (_data != null) { stream = new MemoryStream(_data); Channel.Process(stream); Channel.Save(); } } } catch (Exception ex) { eventArgs = new RunWorkerCompletedEventArgs(e.Result, e.Cancelled, ex); } finally { this.OnSynchronized(this, eventArgs); // Dispose of the download helper and close the memory stream. if (_download != null) _download = null; if (stream != null) stream.Close(); } }
private void DownloadComplete(object sender, RunWorkerCompletedEventArgs e) { HttpDownload download = sender as HttpDownload; if (download != null) { if (_downloads != null && _downloads.Contains(download.Guid)) _downloads.Remove(download.Guid); if (this.HttpDownloadComplete != null) this.HttpDownloadComplete(download.Guid, e); } }
protected virtual void OnSynchronized(object sender, RunWorkerCompletedEventArgs e) { if (this.Synchronized != null) this.Synchronized(sender, e); }