/// <summary> /// Start Tracing /// </summary> private void StartTracing() { if (!this.LocalTraceEnabled && !this.ServerTraceEnabled) { MessageBoxDisplay.ShowMessage("Please enable tracing at the remote host and/or on your local machine.", "Warning"); return; } this.Hooker.ResetId(); if (this.LocalTraceEnabled) // start async to allow the web service to start tracing simultanously on the target host { _TraceStartTime = DateTime.Now; LocalTraceSettings.TraceStates = TraceStates.Starting; if (File.Exists(TraceFileName)) { try { File.Delete(TraceFileName); } catch (Exception ex) { MessageBoxDisplay.ShowMessage($"Could not delete old trace file {TraceFileName}. Is the file still open in WPA? Full error: {ex}", "Error"); LocalTraceSettings.TraceStates = TraceStates.Stopped; return; } } Task.Factory.StartNew <Tuple <int, string> >(() => LocalTraceControler.ExecuteWPRCommand(LocalTraceSettings.TraceStartFullCommandLine)) .ContinueWith(t => LocalTraceSettings.ProcessStartCommand(t.Result), UISheduler); } if (this.ServerTraceEnabled) { ServerTraceSettings.TraceStates = TraceStates.Starting; var command = WCFHost.CreateExecuteWPRCommand(ServerTraceSettings.TraceStartFullCommandLine); command.Completed = (output) => ServerTraceSettings.ProcessStartCommand(output); command.Execute(); } }