public Orchestration GetOrchestration(string assemblyName, string orchestrationName) { Orchestration orch = null; try { this.InitExplorer(this.server, this.mgmtDatabaseName); BizTalkCore.BtsAssembly asm = null; foreach (BizTalk.ExplorerOM.BtsAssembly a in this.explorer.Assemblies) { if (a.DisplayName == assemblyName) { asm = a; break; } } BizTalk.ExplorerOM.BtsOrchestration o = asm.Orchestrations[orchestrationName]; orch = new Orchestration(o.FullName); orch.Load(this.explorer, o); } catch (Exception ex) { TraceManager.SmartTrace.TraceError(ex); } return(orch); }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="shape"></param> private static void GetSelectionAreas(Graphics g, BaseShape shape, Orchestration orchestration, bool drawHotspots) { try { foreach (BaseShape bc in shape.Shapes) { if (bc is ReceiveShape || bc is SendShape || bc is MessageAssignmentShape || bc is VariableAssignmentShape) { OrchShape os = CreateOrchShape(bc); if (os != null) { orchestration.ShapeMap.Add(os); if (drawHotspots) { DrawDebugRect(g, os.SelectionArea.GetRectangle()); } } } GetSelectionAreas(g, bc, orchestration, drawHotspots); } } catch (Exception ex) { string message = ex.Message; } }
private void LoadOrchestrations(BtsCatalogExplorer explorer, Application application) { TraceManager.SmartTrace.TraceIn(); // Orchestrations foreach (BizTalk.ExplorerOM.BtsOrchestration orchestration in application.Orchestrations) { TraceManager.SmartTrace.TraceInfo(orchestration.FullName); Orchestration o = new Orchestration(orchestration.FullName); o.Application = this; o.Load(explorer, orchestration); this.orchestrations.Add(o); } TraceManager.SmartTrace.TraceOut(); }
public static bool SaveOrchestrationToJpg(Orchestration orchestration, string fileName, bool includeCoverage) { bool success = true; Bitmap bmp = null; bmp = GetOrchestationImage(orchestration, includeCoverage); if (bmp != null) { bmp.Save(fileName); bmp.Dispose(); } return(success); }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="shape"></param> /// <param name="orchestration"></param> private static void DrawCoverageAreas(Graphics g, BaseShape shape, Orchestration orchestration, BaseShape parent) { foreach (BaseShape bc in shape.Shapes) { try { if (bc is CallShape || bc is CompensateShape || bc is ConstructShape || bc is DelayShape || //bc is ListenShape || //bc is MessageAssignmentShape || bc is ReceiveShape || bc is RulesShape || bc is SuspendShape || bc is TerminateShape || bc is ThrowShape || bc is TransformShape || bc is VariableAssignmentShape || bc is SendShape) { OrchShape os = CreateOrchShape(bc); if (os != null) { if (orchestration.CoverageShapes.ContainsKey(os.Id)) { OrchShape osTmp = orchestration.CoverageShapes[os.Id] as OrchShape; os.exitCount = osTmp.exitCount; os.entryCount = osTmp.entryCount; } orchestration.ShapeMap.Add(os); DrawCoverageRect(g, os); } } DrawCoverageAreas(g, bc, orchestration, shape); } catch (Exception ex) { TraceManager.SmartTrace.TraceError(ex); } } }
private void FixOrchReferences(BtsAssembly assembly) { foreach (BizTalkCore.BtsOrchestration orchestration in assembly.Orchestrations) { //Orchestration o = this.Application.ParentInstallation.Orchestrations[orchestration.FullName] as Orchestration; Orchestration o = this.GetOrchByFullyQualifiedName(orchestration.FullName, assembly.DisplayName); if (o != null) { o.ParentAssembly = this.NameIdPair; this.orchestrations.Add(o.NameIdPair); } else { TraceManager.SmartTrace.TraceError("Could not locate Orch. References will not be fixed."); } } }
public OrchestrationViewer(Microsoft.Services.Tools.BizTalkOM.Orchestration orchestration) { InitializeComponent(); if (orchestration != null) { this.Text = "Orchestration: " + orchestration.Name; Bitmap bmp = orchestration.GetImage(true); if (bmp != null) { this.pictureBox1.Image = bmp; this.panel1.AutoScrollMinSize = new Size(bmp.Width, bmp.Height); if (bmp.Width < this.Width) { this.Width = bmp.Width + additionalBorderSize; } else { if (bmp.Width < maxDisplaySize) { this.Width = bmp.Width + additionalBorderSize; } } if (bmp.Height < this.Height) { this.Height = bmp.Height + additionalBorderSize; } else { if (bmp.Height < maxDisplaySize) { this.Height = bmp.Height + additionalBorderSize; } } } } }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="shape"></param> private static void GetSelectionAreas(Graphics g, BaseShape shape, Orchestration orchestration, bool drawHotspots) { try { foreach (BaseShape bc in shape.Shapes) { //if (bc is ReceiveShape || // bc is SendShape || // bc is MessageAssignmentShape || // bc is VariableAssignmentShape || // bc is TransformShape)//NJB adding transform if (!bc.HasChildShapes) // Only shapes with no children should be clickable. - CD 20140408 { OrchShape os = CreateOrchShape(bc); if (os != null) { orchestration.ShapeMap.Add(os); if (drawHotspots) { DrawDebugRect(g, os.SelectionArea.GetRectangle()); } } } // Exit gracefully rather than throwing an exception - CD 20140408 else { GetSelectionAreas(g, bc, orchestration, drawHotspots); } } } catch (Exception ex) { string message = ex.Message; TraceManager.SmartTrace.TraceError(ex); } }
/// <summary> /// /// </summary> /// <param name="orchestration"></param> /// <returns></returns> public static Rectangle GetOrchImageSize(Orchestration orchestration) { OrchViewer ov = new OrchViewer(); string text1 = string.Empty; Rectangle maxRect = new Rectangle(0, 0, 0, 0); if (orchestration.ViewData != string.Empty) { int width = 1; int height = 1; Bitmap bmp = new Bitmap(width, height); Graphics memGraphic = Graphics.FromImage(bmp); XLANGView.XsymFile.ReadXsymFromString(ov.Root, orchestration.ViewData, false, ref text1); PageSettings ps = new PageSettings(); Rectangle marginBounds = new Rectangle(0, 0, width, height); PrintPageEventArgs args = new PrintPageEventArgs( memGraphic, marginBounds, marginBounds, ps); maxRect = ov.DoPrintWithSize(args); ps = null; args = null; memGraphic.Dispose(); bmp.Dispose(); } ov.Dispose(); return(maxRect); }
public static bool SaveOrchestrationToJpg(Orchestration orchestration, string fileName) { return(SaveOrchestrationToJpg(orchestration, fileName, false)); }
/// <summary> /// /// </summary> /// <param name="orchestration"></param> /// <returns></returns> public static Bitmap GetOrchestationImage(Orchestration orchestration, bool drawWithCoverage) { OrchViewer ov = new OrchViewer(); string text1 = string.Empty; if (orchestration.ViewData != string.Empty) { XLANGView.XsymFile.ReadXsymFromString(ov.Root, orchestration.ViewData, false, ref text1); PageSettings ps = new PageSettings(); Rectangle maxRect = GetOrchImageSize(orchestration); Bitmap realBmp = new Bitmap(maxRect.Width, maxRect.Height); Graphics realGraphic = Graphics.FromImage(realBmp); PrintPageEventArgs realArgs = new PrintPageEventArgs( realGraphic, maxRect, maxRect, ps); // Set background colour realGraphic.FillRectangle(new SolidBrush(Color.White), maxRect); // Draw the orch image ov.DoPrintWithSize(realArgs); bool drawHotspots = false; try { // Decide whether we need hotspots or not object drawHotspotsObj = new AppSettingsReader().GetValue("ShowHotSpots", typeof(int)); if (drawHotspotsObj != null) { int tmp = Convert.ToInt32(drawHotspotsObj); if (tmp == 1) { drawHotspots = true; } } } catch (Exception ex) { TraceManager.SmartTrace.TraceError(ex); } GetSelectionAreas(realGraphic, ov.Root, orchestration, drawHotspots); if (drawWithCoverage) { DrawCoverageAreas(realGraphic, ov.Root, orchestration, null); } ps = null; realArgs = null; ov.Dispose(); realGraphic.Dispose(); return(realBmp); } else { string errorText = "Unable to load image for orchestration"; Font f = new Font("Arial", 9, FontStyle.Bold); int fontHeight = (int)f.GetHeight() + 5; int errorWidth = MeasureStringWidth(errorText, f); int nameWidth = MeasureStringWidth(orchestration.Name, f); int w = Math.Max(errorWidth, nameWidth) + 50; int h = 100; SolidBrush titleBrush = new SolidBrush(Color.Black); Bitmap bmp = new Bitmap(w, h); Graphics g = Graphics.FromImage(bmp); g.FillRectangle(new SolidBrush(Color.White), 0, 0, w, h); g.DrawString(errorText, f, titleBrush, (bmp.Width / 2) - (errorWidth / 2), 10); g.DrawString(orchestration.Name, f, titleBrush, (bmp.Width / 2) - (nameWidth / 2), 10 + fontHeight); return(bmp); } }
public static Bitmap GetOrchestationImage(Orchestration orchestration) { return(GetOrchestationImage(orchestration, false)); }