Example #1
0
 public void SetProgressValue(int value)
 {
     if (progressSynchronize.InvokeRequired)
     {
         SetProgressValueCallback d = new SetProgressValueCallback(SetProgressValue);
         Invoke(d, new object[] { value });
     }
     else
     {
         progressSynchronize.Value = value; progressSynchronize.Refresh();
     }
 }
Example #2
0
 /// <summary>
 /// Thread-safe method for setting the current value of the progress bar.
 /// </summary>
 private void SetProgressValue(int value)
 {
     if (this.prgUpdate.InvokeRequired)
     {
         SetProgressValueCallback prgCallback = new SetProgressValueCallback(SetProgressValue);
         this.Invoke(prgCallback, new object[] { value });
     }
     else
     {
         prgUpdate.Value = value;
         prgUpdate.Refresh();
     }
 }
Example #3
0
        /// <summary>
        /// Set value property of progress bars
        /// </summary>
        /// <param name="form">The calling form</param>
        /// <param name="control"></param>
        /// <param name="value"></param>
        public static void SetProgressValue(Form form, ProgressBar control, int value)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (control.InvokeRequired)
            {
                SetProgressValueCallback d = new SetProgressValueCallback(SetProgressValue);
                form.Invoke(d, new object[] { form, control, value });

                return;
            }

            control.Value = value;
        }
Example #4
0
 /// <summary>
 /// Changes the progress value of a progress bar
 /// </summary>
 /// <param name="container">The control that contains the control to change</param>
 /// <param name="control">The control to change</param>
 /// <param name="val">The new percentage</param>
 public static void SetProgressValue(Control container, ProgressBar control, int val)
 {
     if (container.InvokeRequired)
     {
         SetProgressValueCallback d = SetProgressValue;
         try
         {
             container.Invoke(d, new object[] { container, control, val });
         }
         catch (Exception) { }
     }
     else
     {
         control.Value = val;
     }
 }
Example #5
0
 public void SetProgressValue(ProgressBar dat, int state)
 {
     if (state > dat.Maximum || state < dat.Minimum)
     {
         return;
     }
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (dat.InvokeRequired)
     {
         SetProgressValueCallback d = new SetProgressValueCallback(SetProgressValue);
         dat.BeginInvoke(new MethodInvoker(() => dat.Value = state));
     }
     else
     {
         dat.Maximum = state;
     }
 }
Example #6
0
 private void SetProgressValue(int value)
 {
     if (UploadProgress.InvokeRequired)
     {
         SetProgressValueCallback spv = new SetProgressValueCallback(SetProgressValue);
         this.Invoke(spv, value);
     }
     else
     {
         UploadProgress.Value = value;
     }
 }