Пример #1
0
        /// <summary>
        /// stop tracing command
        /// </summary>
        internal void StopTracing()
        {
            if (this.CaptureScreenShots) // create html report also if no tracing was active perhaps someone finds this functionality in itself useful
            {
                var htmlReportGenerator = new HtmlReportGenerator(this.ScreenshotDirectory);
                htmlReportGenerator.GenerateReport();
            }

            StopData = new ViewModelFrozenData(this)
            {
                TraceStopFullCommandLine = LocalTraceSettings.TraceStopFullCommandLine,
                TraceStopNotExpanded     = LocalTraceSettings.TraceStop,
                TraceFileName            = TraceFileName,
                TraceStartTime           = this._TraceStartTime,
            };

            if (this.LocalTraceEnabled)
            {
                LocalTraceSettings.TraceStates = TraceStates.Stopping;
                // stop tracing asynchronously so we do not need to wait until local trace collection has stopped (while blocking the UI)
                Task.Factory.StartNew <Tuple <int, string> >(() => LocalTraceControler.ExecuteWPRCommand(StopData.TraceStopFullCommandLine))
                .ContinueWith((t) => LocalTraceSettings.ProcessStopCommand(t.Result), UISheduler);
            }
            if (this.ServerTraceEnabled)
            {
                ServerTraceSettings.TraceStates = TraceStates.Stopping;
                var command = WCFHost.CreateExecuteWPRCommand(StopData.TraceStopFullCommandLine);
                command.Completed = (output) => ServerTraceSettings.ProcessStopCommand(output);
                command.Execute();
            }

            this.TraceFileCounter++;
        }
        public void GenerateHtmlReport()
        {
            string path = @"C:\temp\ScreensTest";

            Directory.CreateDirectory(path);
            var gen = new HtmlReportGenerator(path);

            gen.GenerateReport();
        }