示例#1
0
 private void EventUpdate(object sender, PluginEventArgs e)
 {
     Console.ForegroundColor = ConsoleColor.Green;
     RefreshProgress(sender, e);
     Console.ResetColor();
 }
示例#2
0
        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);
                }
            }
        }
示例#3
0
 private void EventProcessing(object sender, PluginEventArgs e)
 {
     RefreshProgress(sender, e);
 }
示例#4
0
 private void EventStart(object sender, PluginEventArgs e)
 {
     RefreshProgress(sender, e);
 }
示例#5
0
 private void EventExceptionOccurred(object sender, PluginEventArgs e)
 {
     RefreshProgress(sender, e);
 }
示例#6
0
 void EventUpdate(object sender, PluginEventArgs e)
 {
     counter++;
     RefreshProgress(sender, e);
 }
示例#7
0
 void EventExceptionOccurred(object sender, PluginEventArgs e)
 {
     RefreshProgress(sender, e);
     MessageBox.Show(e.RaisedException.ToString(), "Error executing the task!", MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
示例#8
0
 void EventEnd(object sender, PluginEventArgs e)
 {
     RefreshProgress(sender, e);
 }
示例#9
0
        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();
                }
            }
        }