public ExternalCatalogReaderWorker(UpdateProgressBarCallback updateProgressBar)
        {
            _updateProgressBar = updateProgressBar;

            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
            _worker.DoWork             += OnDoWork;
            _worker.ProgressChanged    += OnProgressChanged;
            _worker.RunWorkerCompleted += OnWorkerCompleted;
        }
        public CatalogCheckerWorker(InitProgressBarCallback initProgressBar, UpdateProgressBarCallback updateProgressBar)
        {
            _initProgressBar   = initProgressBar;
            _updateProgressBar = updateProgressBar;

            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
            _worker.DoWork             += OnDoWork;
            _worker.ProgressChanged    += OnProgressChanged;
            _worker.RunWorkerCompleted += OnWorkerCompleted;
        }
        public ActionAnalyzerWorker(UpdateProgressBarCallback updateProgressBar)
        {
            _updateProgressBar = updateProgressBar;

            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
            _worker.DoWork             += OnDoWork;
            _worker.ProgressChanged    += OnProgressChanged;
            _worker.RunWorkerCompleted += OnWorkerCompleted;

            _runWhenReady = false;
        }
示例#4
0
 public void updateProgressBar(int pValue)
 {
     if (this.loadStatusLabel.InvokeRequired)
     {
         UpdateProgressBarCallback d = new UpdateProgressBarCallback(updateProgressBar);
         this.Invoke(d, new object[] { pValue });
     }
     else
     {
         this.splashProgressBar.Value = pValue;
     }
 }
示例#5
0
        public static void UpdateProgressBar(System.Windows.Forms.ProgressBar ProgressBarControl, int PBvalue)
        {
            if (ProgressBarControl == null)
            {
                return;
            }

            if (ProgressBarControl.InvokeRequired)
            {
                UpdateProgressBarCallback d = UpdateProgressBar;
                ProgressBarControl.Invoke(d, new object[] { ProgressBarControl, PBvalue });
            }
            else
            {
                ProgressBarControl.Value = PBvalue;
            }
        }
示例#6
0
        public static void UpdateProgressBar(ProgressBar prg, int value)
        {
            try
            {
                if (prg.InvokeRequired)
                {
                    UpdateProgressBarCallback d = UpdateProgressBar;
                    prg.Invoke(d, prg, value);
                    return;
                }

                prg.Value = value;
            }
            catch
            {
                // This catch is simply here to avoid the OCCASIONAL crash of the application when closing it by pressing the stop button in visual studio while it is running tasks
            }
        }
示例#7
0
        private void UpdateProgressBar(ByteArgs e, int step, int totalsteps)
        {
            if (progressbar.InvokeRequired)
            {
                UpdateProgressBarCallback d = UpdateProgressBar;
                progressbar.Invoke(d, new object[] { e, step, totalsteps });
            }
            else
            {
                int   stepsize = (int)Math.Round((float)progressbar.Maximum / totalsteps);
                float ratio    = (float)e.Downloaded / e.Total;
                int   val      = (int)Math.Floor(stepsize * step + stepsize * ratio);

                if (val <= progressbar.Maximum)
                {
                    progressbar.Value = val;
                    TaskbarProgress.SetValue(this.Handle, progressbar.Value, progressbar.Maximum);
                }
                progressbar.Refresh();
                Invalidate();
            }
        }