private void EventUpdate(object sender, PluginEventArgs e) { Console.ForegroundColor = ConsoleColor.Green; RefreshProgress(sender, e); Console.ResetColor(); }
void RefreshProgress(object sender, PluginEventArgs e) { if (e != null) { if (e.RaisedException != null) { logger.Log(sender, "Error:"); logger.Log(sender, e.RaisedException.Message); } if (e.Progress != null) { IPlugin plugin = (IPlugin)sender; if (plugin != null) { int pct = (int)e.Progress.PctComplete; if (pct == 100) { pctDict.Remove((IPlugin)sender); } else if (pctDict.ContainsKey(plugin)) { pctDict[plugin] = pct; } else { pctDict.Add(plugin, pct); } DisplayProgress(); } } if (!string.IsNullOrEmpty(e.Message)) { logger.Log(sender, e.Message); } } }
private void EventProcessing(object sender, PluginEventArgs e) { RefreshProgress(sender, e); }
private void EventStart(object sender, PluginEventArgs e) { RefreshProgress(sender, e); }
private void EventExceptionOccurred(object sender, PluginEventArgs e) { RefreshProgress(sender, e); }
void EventUpdate(object sender, PluginEventArgs e) { counter++; RefreshProgress(sender, e); }
void EventExceptionOccurred(object sender, PluginEventArgs e) { RefreshProgress(sender, e); MessageBox.Show(e.RaisedException.ToString(), "Error executing the task!", MessageBoxButtons.OK, MessageBoxIcon.Error); }
void EventEnd(object sender, PluginEventArgs e) { RefreshProgress(sender, e); }
void RefreshProgress(object sender, PluginEventArgs e) { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(() => { RefreshProgress(sender, e); })); } else { if (e != null) { if(e.RaisedException != null) { logger.Log(sender, e.RaisedException.Message); } if (e.Progress != null) { itemProgress.Value = (int)e.Progress.PctComplete; lineGraphSpeed.AddDataPoint((float)e.Progress.TransferRate); } else { itemProgress.Value = 0; } if (!string.IsNullOrEmpty(e.Message)) { logger.Log(sender, e.Message); } itemProgress.Refresh(); Application.DoEvents(); } } }