void pInst_OutputDataReceived(object sender, DataReceivedEventArgs outLine) { if (!String.IsNullOrEmpty(outLine.Data)) { if (!cmd.Dispatcher.CheckAccess()) { // Called from a none ui thread, so use dispatcher ShowLoggingDelegate showLoggingDelegate = new ShowLoggingDelegate(ShowLogging); cmd.Dispatcher.Invoke(DispatcherPriority.Normal, showLoggingDelegate, outLine.Data); } else { // Called from UI trhead so just update the textbox ShowLogging(outLine.Data); }; } }
public void ProcessOuputHandler(object sendingProcess, DataReceivedEventArgs outLine) { if (!String.IsNullOrEmpty(outLine.Data)) { if (!Result.Dispatcher.CheckAccess()) { // Called from a none ui thread, so use dispatcher ShowLoggingDelegate showLoggingDelegate = new ShowLoggingDelegate(ShowLogging); Result.Dispatcher.Invoke(DispatcherPriority.Normal, showLoggingDelegate, outLine.Data); } else { // Called from UI trhead so just update the textbox ShowLogging(outLine.Data); Thread.Sleep(100); }; } }