public VA.Scripting.Client GetScriptingClient() { var app = GetVisioApplication(); var client = new VA.Scripting.Client(app); return(client); }
private void draw_dg(VA.Scripting.Client client, string dg_text) { var dg_xml = SXL.XDocument.Parse(dg_text); var dg_model = VA.Scripting.DirectedGraph.DirectedGraphBuilder.LoadFromXML(client, dg_xml); client.Draw.DirectedGraph(dg_model); }
private void draw_directed_graph(VisioAutomation.Scripting.Client client, string dg_text) { var dg_xml = SXL.XDocument.Parse(dg_text); var dg_model = VisioAutomation.Scripting.DirectedGraph.DirectedGraphBuilder.LoadFromXML(client, dg_xml); // TODO: Investigate if this this special case for Visio 2013 can be removed // this is a temporary fix to handle the fact that server_u.vss in Visio 2013 doesn't result in server_u.vssx // gettign automatically loaded var version = client.Application.Version; if (version.Major >= 15) { foreach (var drawing in dg_model) { foreach (var shape in drawing.Shapes) { if (shape.StencilName == "server_u.vss") { shape.StencilName = "server_u.vssx"; } } } } client.Draw.DirectedGraph(dg_model); }
internal TargetShapes ResolveShapes(VisioAutomation.Scripting.Client client) { var shapes = this.__ResolveShapes(client); var targets = new TargetShapes(shapes); return(targets); }
private void draw_org_chart(VisioAutomation.Scripting.Client client, string text) { var xmldoc = SXL.XDocument.Parse(text); var orgchart = VisioAutomation.Scripting.OrgChart.OrgChartBuilder.LoadFromXml(client, xmldoc); client.Draw.OrgChart(orgchart); }
internal TargetShapes ResolveShapes2D(VisioAutomation.Scripting.Client client) { var shapes = this.__ResolveShapes(client); var shapes_2d = shapes.Where(s => s.OneD == 0).ToList(); var targets = new TargetShapes(shapes_2d); return(targets); }
public VisioAutomation.Scripting.Client GetScriptingClient() { var app = this.GetVisioApplication(); // this ensures that any debug, verbose, user , etc. messages are // sent to a useful place in the unit tests var context = new DiagnosticDebugContext(); var client = new VisioAutomation.Scripting.Client(app,context); return client; }
public VisioAutomation.Scripting.Client GetScriptingClient() { var app = this.GetVisioApplication(); // this ensures that any debug, verbose, user , etc. messages are // sent to a useful place in the unit tests var context = new DiagnosticDebugContext(); var client = new VisioAutomation.Scripting.Client(app, context); return(client); }
private void VPTRibbon_Load(object sender, RibbonUIEventArgs e) { try { this.client = new VisioAutomation.Scripting.Client(Globals.ThisAddIn.Application); } catch (System.Exception) { string msg = "Failed to load Visio Power Tools"; MessageBox.Show(msg); } }
private IList <IVisio.Shape> __ResolveShapes(VisioAutomation.Scripting.Client client) { client.Application.AssertApplicationAvailable(); if (this.Shapes == null) { var out_shapes = client.Selection.GetShapes(); client.WriteVerbose("GetTargetShapes: Returning {0} shapes from the active selection", out_shapes.Count); return(out_shapes); } client.WriteVerbose("GetTargetShapes: Returning {0} shapes that were passed in", this.Shapes.Count); return(this.Shapes); }
public static void ExportSelectionToXAML(VA.Scripting.Client client, string filename) { if (filename == null) { throw new System.ArgumentNullException("filename"); } if (!client.Selection.HasShapes()) { return; } var selection = client.Selection.Get(); ExportExtensions.ExportSelectionToXAML(selection, filename, s => client.Output.WriteVerbose(s)); }
internal int SetSelectionGetSelectedCount(VisioAutomation.Scripting.Client client) { client.Application.AssertApplicationAvailable(); if (this.Shapes == null) { int n = client.Selection.Count(); client.WriteVerbose("GetTargetSelectionCount: Using active selection of {0} shapes", n); return(n); } client.WriteVerbose("GetTargetSelectionCount: Reseting selecton to specified {0} shapes", this.Shapes.Count); client.Selection.SelectNone(); client.Selection.Select(this.Shapes); int selected_count = client.Selection.Count(); return(selected_count); }
public static void set_page_size(VA.Scripting.Client client, double width, double height) { double?w = null; double?h = null; if (width > 0) { w = width; } if (height > 0) { h = height; } if (w.HasValue || h.HasValue) { client.Page.SetSize(w, h); } }
public static void InteropEnumDocumentation() { var app = SampleEnvironment.Application; var client = new VisioAutomation.Scripting.Client(app); var doc = client.Developer.DrawInteropEnumDocumentation(); }
public static void VisioAutomationNamespacesAndClasses() { var app = SampleEnvironment.Application; var client = new VisioAutomation.Scripting.Client(app); var doc = client.Developer.DrawNamespacesAndClasses(); }
public ShapeSheetUpdate(VA.Scripting.Client ss,IVisio.Page page) { this.Client = ss; this.TargetPage = page; this.update = new VA.ShapeSheet.Update(); }
public static void ScriptingDocumentation() { var app = SampleEnvironment.Application; var client = new VisioAutomation.Scripting.Client(app); var doc = client.Developer.DrawScriptingDocumentation(); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { this.Client = new VisioAutomation.Scripting.Client(Globals.ThisAddIn.Application); }
private void buttonDiagramWithClasses_Click(object sender, EventArgs e) { var client = new VisioAutomation.Scripting.Client(Globals.ThisAddIn.Application); client.Developer.DrawNamespacesAndClasses(); }
private static List <PageData> LoadPageDataFromXML(VA.Scripting.Client client, SXL.XDocument xmldoc) { var pagedatas = new List <PageData>(); // LOAD and ANALYZE EACH PAGE int pagenum = 0; var page_els = xmldoc.Root.Elements("page"); foreach (var page_el in page_els) { var node_ids = new HashSet <string>(); var con_ids = new HashSet <string>(); var pagedata = new PageData(); pagedatas.Add(pagedata); pagedata.Errors = new List <BuilderError>(); pagedata.LayoutOptions = new VA.Models.DirectedGraph.MSAGLLayoutOptions(); var renderoptions_el = page_el.Element("renderoptions"); GetRenderOptionsFromXml(renderoptions_el, pagedata.LayoutOptions); pagedata.DirectedGraph = new DGMODEL.Drawing(); var shape_els = page_el.Element("shapes").Elements("shape"); var con_els = page_el.Element("connectors").Elements("connector"); pagedata.ShapeInfos = shape_els.Select(e => ShapeInfo.FromXml(client, e)).ToList(); pagedata.ConnectorInfos = con_els.Select(e => ConnectorInfo.FromXml(client, e)).ToList(); client.WriteVerbose("Analyzing shape data for page {0}", pagenum); foreach (var shape_info in pagedata.ShapeInfos) { client.WriteVerbose("shape {0}", shape_info.ID); if (node_ids.Contains(shape_info.ID)) { pagedata.Errors.Add(BuilderError.NodeAlreadyDefined(pagenum, shape_info.ID)); } else { node_ids.Add(shape_info.ID); } } client.WriteVerbose("Analyzing connector data..."); foreach (var con_info in pagedata.ConnectorInfos) { client.WriteVerbose("connector {0}", con_info.ID); if (con_ids.Contains(con_info.ID)) { pagedata.Errors.Add(BuilderError.ConnectorAlreadyDefined(pagenum, con_info.ID)); } else { con_ids.Add(con_info.ID); } if (!node_ids.Contains(con_info.From)) { pagedata.Errors.Add(BuilderError.InvalidFromNode(pagenum, con_info.ID, con_info.From)); } if (!node_ids.Contains(con_info.To)) { pagedata.Errors.Add(BuilderError.InvalidToNode(pagenum, con_info.ID, con_info.To)); } } } return(pagedatas); }
public static IList <DGMODEL.Drawing> LoadFromXML(VA.Scripting.Client client, string filename) { var xmldoc = SXL.XDocument.Load(filename); return(LoadFromXML(client, xmldoc)); }
public ShapeSheetUpdate(VA.Scripting.Client ss, IVisio.Page page) { this.Client = ss; this.TargetPage = page; this.update = new VA.ShapeSheet.Update(); }
public VA.Scripting.Client GetScriptingClient() { var app = GetVisioApplication(); var client = new VA.Scripting.Client(app); return client; }
private void buttonEnums_Click(object sender, EventArgs e) { var client = new VisioAutomation.Scripting.Client(Globals.ThisAddIn.Application); client.Developer.DrawInteropEnumDocumentation(); }
public static IList <DGMODEL.Drawing> LoadFromXML(VA.Scripting.Client client, SXL.XDocument xmldoc) { var pagedatas = LoadPageDataFromXML(client, xmldoc); // STOP IF ANY ERRORS int num_errors = pagedatas.Select(pagedata => pagedata.Errors.Count).Sum(); if (num_errors > 1) { foreach (var pagedata in pagedatas) { foreach (var error in pagedata.Errors) { client.WriteVerbose(error.Text); } client.WriteVerbose("Errors encountered in shape data. Stopping."); } } // DRAW EACH PAGE foreach (var pagedata in pagedatas) { client.WriteVerbose("Creating shape AutoLayout nodes"); foreach (var shape_info in pagedata.ShapeInfos) { var dg_shape = pagedata.DirectedGraph.AddShape(shape_info.ID, shape_info.Label, shape_info.Stencil, shape_info.Master); dg_shape.URL = shape_info.URL; dg_shape.CustomProperties = new Dictionary <string, VACUSTPROP.CustomPropertyCells>(); foreach (var kv in shape_info.custprops) { dg_shape.CustomProperties[kv.Key] = kv.Value; } } client.WriteVerbose("Creating connector AutoLayout nodes"); foreach (var con_info in pagedata.ConnectorInfos) { var def_connector_type = VACXN.ConnectorType.Curved; var connectory_type = def_connector_type; var from_shape = pagedata.DirectedGraph.Shapes.Find(con_info.From); var to_shape = pagedata.DirectedGraph.Shapes.Find(con_info.To); var def_con_color = new VA.Drawing.ColorRGB(0x000000); var def_con_weight = 1.0 / 72.0; var def_end_arrow = 2; var dg_connector = pagedata.DirectedGraph.Connect(con_info.ID, from_shape, to_shape, con_info.Label, connectory_type); dg_connector.Cells = new VA.DOM.ShapeCells(); dg_connector.Cells.LineColor = con_info.Element.AttributeAsColor("color", def_con_color).ToFormula(); dg_connector.Cells.LineWeight = con_info.Element.AttributeAsInches("weight", def_con_weight); dg_connector.Cells.EndArrow = def_end_arrow; } client.WriteVerbose("Rendering AutoLayout..."); } client.WriteVerbose("Finished rendering AutoLayout"); var directedgraphs = pagedatas.Select(pagedata => pagedata.DirectedGraph).ToList(); return(directedgraphs); }