private void dgOrchestration_SelectionChanged(object sender, EventArgs e) { this.dgDebugShapes.Rows.Clear(); if (this.dgOrchestration.SelectedRows.Count > 0) { this.dgDebugShapes.Enabled = true; this.btnGenerate.Enabled = true; string serviceName = (string)this.dgOrchestration.SelectedRows[0].Cells["ServiceName"].Value; string debugSymbols = (string)this.dgOrchestration.SelectedRows[0].Cells["DebugSymbols"].Value; DebugTrace trace = BTSOrchestrationExplorer.GetDebugTrace(serviceName, debugSymbols, FlatteningPrefixType.Indentation); foreach (DebugShape shape in trace.TraceDetails) { this.dgDebugShapes.Rows.Add( shape.shapeText, shape.shapeType.ToString(), "true", "true", "1", shape.ShapeID.ToString()); } } }
private void btnGenerate_Click(object sender, EventArgs e) { if (this.dgOrchestration.SelectedRows.Count > 0) { DataGridViewRow dr = this.dgOrchestration.SelectedRows[0]; string serviceName = (string)dr.Cells["ServiceName"].Value; string debugSymbols = (string)dr.Cells["DebugSymbols"].Value; string destPath; destPath = Path.Combine(this._targetFolder, this._requestedFileName); FileInfo fi = new FileInfo(destPath); int i = 0; while (fi.Exists) { i++; destPath = Path.Combine(this._targetFolder, String.Format("{0}-{2}{1}", fi.Name.Replace(fi.Extension, ""), fi.Extension, i)); fi = new FileInfo(destPath); } DebugTrace originalTrace = BTSOrchestrationExplorer.GetDebugTrace(serviceName, debugSymbols, FlatteningPrefixType.ParentName); DebugTrace trace = new DebugTrace(); foreach (DataGridViewRow row in this.dgDebugShapes.Rows) { if (Boolean.Parse((string)row.Cells["AddToScenario"].Value)) { DebugShape shape = originalTrace.TraceDetails.Single(s => s.ShapeID.ToString() == (string)row.Cells["ShapeID"].Value); shape.Completed = Boolean.Parse((string)row.Cells["MustComplete"].Value); shape.RepeatCount = Int32.Parse((string)row.Cells["RepeatCount"].Value); trace.TraceDetails.Add(shape); } } trace.Export(destPath); if (this._project != null) { EnvDTE.ProjectItem item = this._project.ProjectItems.AddFromFile(destPath); EnvDTE.Property prop = item.Properties.Item("BuildAction"); prop.Value = 2; Tools.AddConfigKeys(this._project, this.txtDTAServerName.Text, this.txtDTADBName.Text, "BizTalkMgmtDb"); } this.Close(); } }