void backgroundWorkerPipelineBreakdown_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { UpdatePipelineBreakdownVisualization(); pipelineBreakdownTestDirector = null; } catch { } }
private void UpdatePipelineBreakdownVisualization() { try { lock (syncRoot) { if (pipelineBreakdownTestDirector == null) return; bool bFailed = pipelineBreakdownTestDirector.Failed; lTickerCounter++; TimeSpan ts = new TimeSpan(); ts = ts.Add(DateTime.Now.Subtract(pipelineBreakdownTestDirector.StartTime)); this.lblStatus.Text = "Status: " + pipelineBreakdownTestDirector.Status + " Time: " + ts.ToString().Substring(0, 8); //if the package is still running, then only update the grid every other call to this function if (lTickerCounter % 2 == 1 && backgroundWorkerPipelineBreakdown.IsBusy) return; if (!backgroundWorkerPipelineBreakdown.IsBusy || bFailed) { timer1.Enabled = false; timer1.Stop(); StopButton.Enabled = false; System.Threading.Thread.Sleep(1000); //pause just in case we need another second for the log events to quit flowing } //TODO: future: only refresh when the Performance tab is visible? only if there are performance problems BindingSource binding = new BindingSource(this.components); binding.DataSource = pipelineBreakdownTestDirector.GetTestsToDisplay(); this.dtsPipelineBreakdownGrid.DataSource = binding; if (!backgroundWorkerPipelineBreakdown.IsBusy || bFailed) { timer1.Enabled = false; timer1.Stop(); this.pipelineBreakdownTestDirector = null; this.StartButton.Enabled = true; this.StopButton.Enabled = false; } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); timer1.Stop(); } }
public void BreakdownPipelinePerformance(string DataFlowTaskID) { try { if (this.projectItem.DTE.Mode == vsIDEMode.vsIDEModeDebug) { MessageBox.Show("Please stop the debugger first."); return; } if (this.IsExecuting) { MessageBox.Show("You may not execute the package until the previous execution of the package completes."); return; } lTickerCounter = 0; ExecutionCancelled = false; if (this.lastDataFlowTaskID != DataFlowTaskID) { this.dtsPipelineBreakdownGrid.ClearHistory(); //TODO: create multiple instances of the breakdown grid, one for each data flow? } this.lastDataFlowTaskID = DataFlowTaskID; //TODO: add dropdown this.lblStatus.Text = "Status: Preparing Testing Iterations"; RefreshProjectAndPackageProperties(); pipelineBreakdownTestDirector = new DtsPipelineTestDirector(projectItem.get_FileNames(0), DataFlowTaskID); pipelineBreakdownTestDirector.DtexecPath = this.dtexecPath; pipelineBreakdownTestDirector.PackagePassword = this.packagePassword; pipelineBreakdownTestDirector.PerformanceTab = this; backgroundWorkerPipelineBreakdown = new BackgroundWorker(); backgroundWorkerPipelineBreakdown.DoWork += new DoWorkEventHandler(backgroundWorkerPipelineBreakdown_DoWork); backgroundWorkerPipelineBreakdown.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorkerPipelineBreakdown_RunWorkerCompleted); backgroundWorkerPipelineBreakdown.RunWorkerAsync(); this.dtsPipelineBreakdownGrid.AddNewColumnOnNextDataBinding = true; timer1.Enabled = true; timer1.Start(); this.StopButton.Enabled = true; this.StartButton.Enabled = false; this.lblStatus.Text = "Status: Executing Testing Iterations"; SwitchToPipelineBreakdownGridMenuClicked(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }