private void manager_OnJobErrorEvent(object sender, ErrorNotificationEventArgs e) { if (base.InvokeRequired) { EventHandler <ErrorNotificationEventArgs> method = new EventHandler <ErrorNotificationEventArgs>(this.manager_OnJobErrorEvent); base.Invoke(method, new object[] { sender, e }); } else if (this.jobWrappers.ContainsKey(e.Job.JobId)) { this.UpdateControl(this.jobWrappers[e.Job.JobId]); } }
/// <summary>Reports a download error.</summary> /// <param name="sender">The object that called the event.</param> /// <param name="e">The <c>SharpBits.Base.ErrorNotificationEventArgs</c> instance containing the event data.</param> static void ReportDownloadError(object sender, ErrorNotificationEventArgs e) { if (e.Job == null) { return; } if (e.Job.DisplayName != jobName) { return; } if (e.Job.State != JobState.Error) { return; } errorOccurred = true; if (e.Job.State != JobState.Canceled) { e.Job.Cancel(); } try { manager.Dispose(); manager = null; } catch (ObjectDisposedException) { } string error = null; if (e.Error != null) { error = " " + e.Error.Description + " " + e.Error.ContextDescription; if (e.Error.File != null) { error += " " + e.Error.File.RemoteName; } } Utilities.ReportError(new WebException(error), ErrorType.DownloadError); return; }
private void manager_OnJobError(object sender, ErrorNotificationEventArgs e) { this.OutputMessage(string.Format("Job '{0}' failed on transfer: {1}", e.Job.DisplayName, e.Error.Description)); }