public ScriptExecutionResult Execute(string entryFunctionName = null) { var stopwatch = Stopwatch.StartNew(); var result = new ScriptExecutionResult(); try { lock (_syncRoot) { result.Value = ExecuteInternal(entryFunctionName)?.ToObject(); } } catch (Exception exception) { result.Exception = exception; } finally { stopwatch.Stop(); result.Duration = (int)stopwatch.Elapsed.TotalMilliseconds; result.Trace = DebugOutput.ToString(); } CreateLogEntry(result); return(result); }
private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (Visibility == Visibility.Visible) { DebugOutputTextBox.Text = DebugOutput.ToString(); } }
private void HandleTextboxRightClick(object sender, MouseButtonEventArgs e) { const string fn = "JavascriptDebugWindow.HandleTextboxRightClick()"; try { // should do this with a right click menu item, but need time to figure out how to do that in WPF DebugOutput.Clear(); DebugOutputTextBox.Text = DebugOutput.ToString(); } catch (Exception ex) { LogHelper.LogMessage(LogLevel.Error, "Exception clearing log output", ex); } }
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e) { while ((DateTime.Now - LastUpdateTime).TotalMilliseconds < 100) { Thread.Sleep(100); } try { SetOutputText(this, DebugOutput.ToString()); LastUpdateTime = DateTime.Now; } catch (Exception ex) { LogHelper.LogException(ex); } }