예제 #1
0
 /// <summary>
 /// Increments targeted ProgressBar.
 /// </summary>
 /// <param name="amount">Optional. Amount to increment bar by. Defaults to 1.</param>
 public void IncrementBar(int amount = 1)
 {
     if (Strip.InvokeRequired)
     {
         Strip.BeginInvoke(new Action(() => Progbar.Increment(amount)));
     }
     else
     {
         Progbar.Increment(amount);
     }
 }
예제 #2
0
 /// <summary>
 /// Updates text of targeted text property.
 /// </summary>
 /// <param name="text">New text to display.</param>
 public void UpdateText(string text)
 {
     // KFreon: Check which control to update
     if (control == null)
     {
         if (strip.InvokeRequired)
         {
             strip.BeginInvoke(new Action(() => UpdateText(text)));
         }
         else
         {
             item.Text = text;
         }
     }
     else
     {
         if (control.InvokeRequired)
         {
             control.BeginInvoke(new Action(() => control.Text = text));
         }
         else
         {
             control.Text = text;
         }
     }
 }
예제 #3
0
 public void InvokeIfRequired(MethodInvoker _delegate)
 {
     if (ToolStrip.InvokeRequired)
     {
         ToolStrip.BeginInvoke(_delegate);
     }
     else
     {
         _delegate();
     }
 }
예제 #4
0
 /// <summary>
 /// Thread-safe
 /// </summary>
 public static void ClearAllSelections(this ToolStrip toolstrip)
 {
     if (toolstrip.InvokeRequired)
     {
         toolstrip.BeginInvoke(new Action(() => ClearAllSelections(toolstrip)));
     }
     else
     {
         ClearAllSelectionsMethod.Invoke(toolstrip, null);
     }
 }
예제 #5
0
 /// <summary>
 /// Sets the causes validation.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void SetCausesValidation(this ToolStrip control, bool value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetCausesValidation(value)));
     }
     else
     {
         control.CausesValidation = value;
         control.Refresh();
     }
 }
예제 #6
0
 /// <summary>
 /// Sets the layout style.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetLayoutStyle(this ToolStrip control, ToolStripLayoutStyle value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetLayoutStyle(value)));
     }
     else
     {
         control.LayoutStyle = value;
         control.Refresh();
     }
 }
예제 #7
0
 /// <summary>
 /// Sets the dock.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetDock(this ToolStrip control, DockStyle value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetDock(value)));
     }
     else
     {
         control.Dock = value;
         control.Refresh();
     }
 }
예제 #8
0
 private void EnableToolStripControl(ToolStrip toolstrip, ToolStripComboBox cb, bool enable)
 {
     if (toolstrip.InvokeRequired)
     {
         EnableToolStripControlCallback d = new EnableToolStripControlCallback(EnableToolStripControl);
         toolstrip.BeginInvoke(d, new object[] { toolstrip, cb, enable });
     }
     else
     {
         cb.Enabled = enable;
     }
 }
예제 #9
0
 /// <summary>
 /// Sets the anchor.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetAnchor(this ToolStrip control, AnchorStyles value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetAnchor(value)));
     }
     else
     {
         control.Anchor = value;
         control.Refresh();
     }
 }
예제 #10
0
 /// <summary>
 /// Sets the automatic scroll.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void SetAutoScroll(this ToolStrip control, bool value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetAutoScroll(value)));
     }
     else
     {
         control.AutoScroll = value;
         control.Refresh();
     }
 }
예제 #11
0
 /// <summary>
 /// Sets the show item tool tips.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void SetShowItemToolTips(this ToolStrip control, bool value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetShowItemToolTips(value)));
     }
     else
     {
         control.ShowItemToolTips = value;
         control.Refresh();
     }
 }
예제 #12
0
 /// <summary>
 /// Sets the text direction.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetTextDirection(this ToolStrip control, ToolStripTextDirection value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetTextDirection(value)));
     }
     else
     {
         control.TextDirection = value;
         control.Refresh();
     }
 }
예제 #13
0
 /// <summary>
 /// Sets the binding context.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetBindingContext(this ToolStrip control, BindingContext value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetBindingContext(value)));
     }
     else
     {
         control.BindingContext = value;
         control.Refresh();
     }
 }
예제 #14
0
 /// <summary>
 /// Sets the render mode.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetRenderMode(this ToolStrip control, ToolStripRenderMode value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetRenderMode(value)));
     }
     else
     {
         control.RenderMode = value;
         control.Refresh();
     }
 }
예제 #15
0
 /// <summary>
 /// Sets the size of the image scaling.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetImageScalingSize(this ToolStrip control, Size value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetImageScalingSize(value)));
     }
     else
     {
         control.ImageScalingSize = value;
         control.Refresh();
     }
 }
예제 #16
0
 /// <summary>
 /// Sets the image list.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetImageList(this ToolStrip control, ImageList value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetImageList(value)));
     }
     else
     {
         control.ImageList = value;
         control.Refresh();
     }
 }
예제 #17
0
 /// <summary>
 /// Sets the grip margin.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetGripMargin(this ToolStrip control, Padding value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetGripMargin(value)));
     }
     else
     {
         control.GripMargin = value;
         control.Refresh();
     }
 }
예제 #18
0
 /// <summary>
 /// Sets the allow item reorder.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void SetAllowItemReorder(this ToolStrip control, bool value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetAllowItemReorder(value)));
     }
     else
     {
         control.AllowItemReorder = value;
         control.Refresh();
     }
 }
예제 #19
0
 /// <summary>
 /// Sets the color of the fore.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetForeColor(this ToolStrip control, Color value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetForeColor(value)));
     }
     else
     {
         control.ForeColor = value;
         control.Refresh();
     }
 }