public void WriteStatus(string message, params object[] args) { try { _box.Invoke(new Action(() => { _box.Text = GenericProgress.SafeFormat(message + Environment.NewLine, args); })); } catch (Exception) { } }
public void WriteStatus(string message, params object[] args) { string theMessage = GenericProgress.SafeFormat(message, args); LastStatus = theMessage; if (SyncContext != null) { SyncContext.Post(UpdateText, theMessage); } else { Text = theMessage; } }
public void WriteMessage(string message, params object[] args) { // if (!_loaded) // return; try { // string theMessage = GenericProgress.SafeFormat(message, args); // //Guard.AgainstNull(SyncContext,"SyncContext"); // ///SyncContext.Post(UpdateText, theMessage); // // this.Invoke(new Action(() => { UpdateText(theMessage);})); // Application.DoEvents(); string theMessage = GenericProgress.SafeFormat(message, args); // if (SyncContext != null) // { // SyncContext.Post(UpdateText, theMessage);//Post() means do it asynchronously, don't wait around and see if there is an exception // } // else // { // Text = theMessage; // } //if (IsHandleCreated) { if (InvokeRequired) { BeginInvoke(new Action(() => UpdateText(theMessage))); } else { UpdateText(theMessage); } } // else // { // // in this case InvokeRequired might lie - you need to make sure that this never happens! // throw new Exception("Somehow Handle has not yet been created on the UI thread!"); // } } catch (Exception error) { #if DEBUG Debug.Fail(error.Message); #endif } }
public override void WriteMessage(string message, params object[] args) { try { // if (_box.InvokeRequired) _box.Invoke(new Action(() => { _box.Text += " ".Substring(0, indent * 2); _box.Text += GenericProgress.SafeFormat(message + Environment.NewLine, args); })); } catch (Exception) { } // _box.Invoke(new Action<TextBox, int>((box, indentX) => // { // box.Text += " ".Substring(0, indentX * 2); // box.Text += GenericProgress.SafeFormat(message + Environment.NewLine, args); // }), _box, indent); }
public void WriteMessage(string message, params object[] args) { try { string theMessage = GenericProgress.SafeFormat(message, args); if (InvokeRequired) { BeginInvoke(new Action(() => UpdateText(theMessage))); } else { UpdateText(theMessage); } } catch (Exception error) { #if DEBUG Debug.Fail(error.Message); #endif } }
public void WriteError(string message, params object[] args) { ErrorEncountered = true; LastError = GenericProgress.SafeFormat(message, args); LastStatus = LastError; }
public void WriteWarning(string message, params object[] args) { WarningEncountered = true; LastWarning = GenericProgress.SafeFormat(message, args); LastStatus = LastWarning; }