Ejemplo n.º 1
0
 private void InstanceMethodExecuteUpdateProgressEvent(object sender, ProgressiveUpdateArgs e)
 {
     Console.WriteLine("Update progress: " + e.Value + " -" + e.Status);
     if (worker.IsBusy)
     {
         worker.ReportProgress(0, e);
     }
     else
     {
         UpdateProgressive(e);
     }
     //this.Invoke(new Method(this.UpdateProgressive), arg);
 }
Ejemplo n.º 2
0
        public void Finish()
        {
            var args = new ProgressiveUpdateArgs()
            {
                Mode = ProgressUpdateMode.Finish
            };

            if (MethodExecuteUpdateProgressEvent == null)
            {
                return;
            }
            MethodExecuteUpdateProgressEvent(this, args);
        }
Ejemplo n.º 3
0
        public void UpdateProgress(string status)
        {
            var args = new ProgressiveUpdateArgs()
            {
                Status = status, Mode = ProgressUpdateMode.Update
            };

            if (MethodExecuteUpdateProgressEvent == null)
            {
                return;
            }
            MethodExecuteUpdateProgressEvent(this, args);
        }
Ejemplo n.º 4
0
        public void UpdateProgress(int value, ProgressUpdateMode mode)
        {
            var args = new ProgressiveUpdateArgs()
            {
                Value = value, Mode = mode
            };

            if (MethodExecuteUpdateProgressEvent == null)
            {
                return;
            }
            MethodExecuteUpdateProgressEvent(this, args);
        }
Ejemplo n.º 5
0
        public void ResetProgress(int maximum, string status)
        {
            var args = new ProgressiveUpdateArgs()
            {
                Maximum = maximum, Status = status, Mode = ProgressUpdateMode.Reset
            };

            if (MethodExecuteUpdateProgressEvent == null)
            {
                return;
            }
            MethodExecuteUpdateProgressEvent(this, args);
        }
Ejemplo n.º 6
0
        public void UpdateProgressive(ProgressiveUpdateArgs arg)
        {
            switch (arg.Mode)
            {
            case ProgressUpdateMode.Reset:
                if (this.worker.IsBusy)
                {
                    ProgressiveDialog.Instance.Initialize(0, arg.Maximum);
                }
                this.toolStripProgressBar.Maximum = arg.Maximum;
                this.toolStripProgressBar.Value   = 0;
                this.toolStripStatus.Text         = string.Empty;
                this.toolStripProgressBar.Visible = true;
                break;

            case ProgressUpdateMode.Update:
                if (arg.Value != 0 && !String.IsNullOrEmpty(arg.Status))
                {
                    if (this.worker.IsBusy)
                    {
                        ProgressiveDialog.Instance.UpdateProgress(arg.Status, arg.Value);
                    }
                    this.toolStripStatus.Text       = arg.Status;
                    this.toolStripProgressBar.Value = arg.Value;
                }
                else if (arg.Value != 0)
                {
                    if (this.worker.IsBusy)
                    {
                        ProgressiveDialog.Instance.UpdateProgress(arg.Value);
                    }
                    this.toolStripProgressBar.Value = arg.Value;
                }
                else if (!String.IsNullOrEmpty(arg.Status))
                {
                    if (this.worker.IsBusy)
                    {
                        ProgressiveDialog.Instance.UpdateStatus(arg.Status);
                    }
                    this.toolStripStatus.Text = arg.Status;
                }
                break;

            case ProgressUpdateMode.AddProgress:
                if (arg.Value != 0 && !String.IsNullOrEmpty(arg.Status))
                {
                    if (this.worker.IsBusy)
                    {
                        ProgressiveDialog.Instance.AddProgress(arg.Status, arg.Value);
                    }
                    this.toolStripStatus.Text        = arg.Status;
                    this.toolStripProgressBar.Value += arg.Value;
                }
                else if (arg.Value != 0)
                {
                    if (this.worker.IsBusy)
                    {
                        ProgressiveDialog.Instance.AddProgress(arg.Value);
                    }
                    this.toolStripProgressBar.Value += arg.Value;
                }
                break;

            case ProgressUpdateMode.Finish:
                this.toolStripStatus.Text         = "Ready";
                this.toolStripProgressBar.Value   = this.toolStripProgressBar.Maximum;
                this.toolStripProgressBar.Visible = false;
                break;

            default:
                break;
            }
        }