void Logger_OnLogEvent(object sender, StatusEventArgs e) { if (this.statusStrip1.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(Logger_OnLogEvent); this.Invoke(d, new object[] { this, e }); } else { SetMessageText(e.Message); } }
private void SetStatusText(String newtext) { if (this.txtStatus.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetStatusText); this.Invoke(d, new object[] { newtext }); } else { this.txtStatus.Text = newtext; } }
public void SetStatusText(string text) { if (this.lblStatus.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetStatusText); this.Invoke(d, new object[] { text }); } else { this.lblStatus.Text = text; } }
//Método de chamada com sincronização de threads para alterar o texto da label de status private void setStatusText(string p_Text) { if (m_LblSpheroStatus.InvokeRequired) { SetStatusTextCallback v_Callback = new SetStatusTextCallback(setStatusText); this.Invoke(v_Callback, new object[] { p_Text }); } else { m_LblSpheroStatus.Text = p_Text; } }
public void SetStatusText(String text) { if (label_status.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetStatusText); this.Invoke(d, new Object[] { text }); } else { label_status.Text = text; } }
private void SetLobbyBoxText(string text) { // 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 (_lobbyMessageBox.InvokeRequired) { SetStatusTextCallback d = SetLobbyBoxText; _lobbyMessageBox.Invoke(d, text); } else { _lobbyMessageBox.Text = text; } }
private void SetSteamStatusText(string text) { // 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 (SteamStatusLabel.InvokeRequired) { SetStatusTextCallback d = SetSteamStatusText; Invoke(d, text); } else { SteamStatusLabel.Text = "Status: " + text; } }
public void setStatusText(string msg) { //把鼠标放上去看解释就知道了,就是防止创建控件以外的线程调用(.NET是类型安全的) if (this.statusStrip.InvokeRequired) { //为当前控件指定委托 SetStatusTextCallback d = new SetStatusTextCallback(setStatusText); this.Invoke(d, new object[] { msg }); //this.Invoke(new addms g(AddMsg), msg); } else { //被委托到主线程后真正执行的代码 //为什么会执行到这里? //不好解释,大概是因为委托的主线程后,this.InvokeRequired=false了吧 this.toolStripStatusLabel_download_status.Text = msg; } }
public void SetStatusText(string status) { // 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.statusStrip.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetStatusText); try { this.Invoke(d, new object[] { status }); } catch (Exception ex) { Debug.WriteLine(ex.StackTrace); Application.Exit(); } } else { this.statusText.Text = status; } }
private void SetETAText(string text) { if (label11.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetETAText); this.Invoke(d, new object[] { text }); } else label11.Text = text; Application.DoEvents(); }
private void SetStatusText(string text) { if ( this.tbStatus.InvokeRequired) { SetStatusTextCallback s = new SetStatusTextCallback(SetStatusText); this.Invoke(s, new object[] { text }); } else { this.tbStatus.Text = text; } }
private void SetStatusText(string text) { // Make sure we're calling this method from the correct thread... if (statusBar1.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetStatusText); this.Invoke(d, new object[] {text}); } else { statusBar1.Text = text; } }
private void SetStatusText(string text) { try { if (this.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(SetStatusText); this.Invoke(d, new object[] { text }); } else { statusText.Text = text; } } catch (ObjectDisposedException) { } }
void Logger_OnLogEvent(object sender, StatusEventArgs e) { if (this.statusStrip1.InvokeRequired) { SetStatusTextCallback d = new SetStatusTextCallback(Logger_OnLogEvent); this.Invoke(d, new object[] { this, e }); } else { SetMessageText(e.Message); } }