/// <summary> /// Performs the click. /// </summary> /// <param name="xButton">The x button.</param> public static void PerformClick(System.Windows.Forms.Button xButton) { if (xButton.InvokeRequired) { PerformClick_Delegate xFun = new PerformClick_Delegate(PerformClick); xButton.Invoke(xFun, new object[] { xButton }); return; } xButton.PerformClick(); }
/// <summary> /// 스레드에서 버튼 속성 변경 /// </summary> /// <param name="str">텍스트</param> /// <param name="On_Off">활성/비활성</param> public static void buttonToggle(System.Windows.Forms.Button button, string str, bool On_Off) { if (button.InvokeRequired) { SetButtonCallBack dele = new SetButtonCallBack(buttonToggle); button.Invoke(dele, button, str, On_Off); } else { button.Enabled = On_Off; if (str.Length > 0) { button.Text = str; } } }
public void serverPollingThread() { if (_client == null) { int counter = 0; while (_client == null) { TryConnecting(++counter, _serverIP, _port); Thread.Sleep(3000); } } _client.SendTimeout = 60000000; _client.ReceiveTimeout = 600000; _btStart.Invoke(new Action(() => _btStart.Enabled = true)); }