Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     this.form = this;
     SetStatusLabelDelegate = new SetStatusLabelCallback(SetStatusLabel);
     SetButtonDelegate      = new SetButtonCallback(SetButton);
     OpenNextFormDelegate   = new OpenNextFormCallback(OpenNextForm);
 }
Exemplo n.º 2
0
 // 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;
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 private void setButtonText(string btText)
 {
     if (this.btStartStop.InvokeRequired)
     {
         SetButtonCallback d = new SetButtonCallback(setButtonText);
         this.Invoke(d, new object[] { btText });
     }
     else
     {
         btStartStop.Text = btText;
     }
 }
Exemplo n.º 5
0
 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;
     }
 }
Exemplo n.º 6
0
 /// <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;
     }
 }
Exemplo n.º 7
0
 // funkcija za disable button-a
 private void disableButton()
 {
     if (buttonThread.InvokeRequired)
     {
         SetButtonCallback d = new SetButtonCallback(disableButton);
         Invoke(d);
     }
     else
     {
         buttonThread.Enabled = false;
     }
 }
Exemplo n.º 8
0
 /// <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;
     }
 }
Exemplo n.º 9
0
 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;
     }
 }
Exemplo n.º 10
0
 /// <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;
     }
 }
Exemplo n.º 11
0
 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;
     }
 }
Exemplo n.º 12
0
 public void SetButton()
 {
     if (progressBar1.InvokeRequired)
     {
         SetButtonCallback d = SetButton;
         Invoke(d);
     }
     else
     {
         btnStart.Enabled = true;
         btnPause.Enabled = false;
         btnEnd.Enabled   = false;
     }
 }
Exemplo n.º 13
0
 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;
         }
     }
 }
Exemplo n.º 14
0
 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;
     }
 }
Exemplo n.º 15
0
        /// <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;
        }
Exemplo n.º 16
0
 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;
     }
 }
Exemplo n.º 17
0
 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;
     }
 }
Exemplo n.º 18
0
 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();
     }
 }
Exemplo n.º 19
0
 /// <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;
     }
 }
Exemplo n.º 20
0
 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;
     }
 }
Exemplo n.º 21
0
 // funkcija za enable button-a
 private void enableButton()
 {
     if (buttonThread.InvokeRequired)
     {
         SetButtonCallback d = new SetButtonCallback(enableButton);
         Invoke(d);
     }
     else
     {
         buttonThread.Enabled = true;
     }
 }