private void ProcExit(object sender, EventArgs e) { if (!Result.Dispatcher.CheckAccess()) { // Called from a none ui thread, so use dispatcher ChangeButtonDelegate changeButtonDelegate = new ChangeButtonDelegate(ChangeStatic); DownloadButton.Dispatcher.Invoke(DispatcherPriority.Normal, changeButtonDelegate); } else { // Called from UI trhead so just update the textbox ChangeStatic(); } }
private void ChangeButton(Button button,string text) { if (button.InvokeRequired) { ChangeButtonDelegate del = new ChangeButtonDelegate(ChangeButton); button.Invoke(del, button,text); } else { button.Text = text; } }