public Form1() { InitializeComponent(); this.form = this; SetStatusLabelDelegate = new SetStatusLabelCallback(SetStatusLabel); SetButtonDelegate = new SetButtonCallback(SetButton); OpenNextFormDelegate = new OpenNextFormCallback(OpenNextForm); }
// To set the button to enabled and prevent cross-thread issues #region SetButton() function public void SetButton(Button b) { if (this.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButton); this.Invoke(d, b); return; } b.Enabled = true; }
public void SetButtonLabel(Button button, string text) { if (button.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButtonLabel); this.Invoke(d, new object[] { button, text }); } else { button.Text = text; } }
private void setButtonText(string btText) { if (this.btStartStop.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(setButtonText); this.Invoke(d, new object[] { btText }); } else { btStartStop.Text = btText; } }
private void Update_Button(Button l, bool t) { if (l.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(Update_Button); this.Invoke(d, new Object[] { l, t }); } else { l.Enabled = t; } }
/// <summary> /// Acts as angular disable="false" atribute /// </summary> /// <param name="con">Control to be enabled</param> private void EnableControls(Control con) { if (con.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(EnableControls); Invoke(d, new object[] { con }); } else { con.Enabled = true; } }
// funkcija za disable button-a private void disableButton() { if (buttonThread.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(disableButton); Invoke(d); } else { buttonThread.Enabled = false; } }
/// <summary> /// Updates the text on the buttons /// </summary> /// <param name="button"></param> /// <param name="text"></param> private void updateButton(Button button, string text) { if (button.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(updateButton); this.Invoke(d, new object[] { button, text }); } else { button.Text = text; } }
public void SetPort(string text, bool Enable) { if (this.txbPCPort.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetPort); this.Invoke(d, new object[] { text, Enable }); } else { this.txbPCPort.Enabled = Enable; } }
/// <summary> /// 调试进程退出时 /// </summary> private void ps_Exited(object sender, EventArgs e) { if (this.button1.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetControlsEnable); this.Invoke(d); } else { this.button1.Enabled = true; this.ControlBox = true; } }
public void SetButton2(string text, bool Enable) { if (this.StopListenButton.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButton2); this.Invoke(d, new object[] { text, Enable }); } else { this.StopListenButton.Enabled = Enable; this.StopListenButton.Text = text; } }
public void SetButton() { if (progressBar1.InvokeRequired) { SetButtonCallback d = SetButton; Invoke(d); } else { btnStart.Enabled = true; btnPause.Enabled = false; btnEnd.Enabled = false; } }
public static void SetButton(Form form, Control ctrl, bool value) { if (ctrl.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButton); form.Invoke(d, new object[] { form, ctrl, value }); } else { if (ctrl is Button) { ((Button)ctrl).Enabled = value; } } }
private void SetButton(bool buttonEnable) { // 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 (this.buttonCh1Output.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButton); this.Invoke(d, new object[] { buttonEnable }); } else { buttonCh1Output.Enabled = buttonEnable; } }
/// <summary> /// Locks or unlocks the colored game buttons /// </summary> /// <param name="status">Bool for button status</param> public void ButtonLock(bool status) { // Check if invocation required due to threading issues if (this.InvokeRequired) { // Set the callback, and invoke the object SetButtonCallback d = new SetButtonCallback(ButtonLock); this.Invoke(d, new object[] { status }); } // Update the button status with either true or false // to "lock" them. btnOne.Enabled = status; btnTwo.Enabled = status; btnThree.Enabled = status; btnFour.Enabled = status; }
public void ResetButtonStatus(bool bStatus) { if (this.StartButton.InvokeRequired || this.StopButton.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(ResetButtonStatus); this.Invoke(d, new object[] { bStatus }); } else { UserNameText.Enabled = bStatus; PasswordText.Enabled = bStatus; StartButton.Enabled = bStatus; StopButton.Enabled = !bStatus; NumLimit.Enabled = bStatus; } }
private void SetButton(Control ctrl, bool enable) { // 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 (this.labelStatus.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButton); this.Invoke(d, new object[] { ctrl, enable }); } else { ctrl.Enabled = enable; } }
public void ChangeButton(bool enable) { if (this.sendTopologyButton.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(ChangeButton); this.Invoke(d, new object[] { enable }); } else { this.sendTopologyButton.Enabled = enable; //timer1 = new System.Windows.Forms.Timer(this.components); //this.timer1.Tick += new System.EventHandler(this.timer1_Tick); this.timer1.Enabled = true; this.timer1.Start(); } }
/// <summary> /// 调试进程退出时 /// </summary> private void ps_Exited(object sender, EventArgs e) { if (this.button1.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetControlsEnable); this.Invoke(d); } else { this.button1.Enabled = true; this.ControlBox = true; } }
private void SetButton(bool buttonEnable) { // 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 (this.buttonCh1Output.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(SetButton); this.Invoke(d, new object[] { buttonEnable }); } else { buttonCh1Output.Enabled = buttonEnable; } }
// funkcija za enable button-a private void enableButton() { if (buttonThread.InvokeRequired) { SetButtonCallback d = new SetButtonCallback(enableButton); Invoke(d); } else { buttonThread.Enabled = true; } }