private void ProcessCommand_ShapeSheet_AddControlsRow(Microsoft.Office.Interop.Visio.Shape shape, XElement addControlsRowElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { // Required attributes string rowName = addControlsRowElement.Attribute("Name").Value; string X = addControlsRowElement.Attribute("X").Value; string Y = addControlsRowElement.Attribute("Y").Value; string XDynamics = addControlsRowElement.Attribute("XDynamics").Value; string YDynamics = addControlsRowElement.Attribute("YDynamics").Value; string XBehavior = addControlsRowElement.Attribute("XBehavior").Value; string YBehavior = addControlsRowElement.Attribute("YBehavior").Value; string canGlue = addControlsRowElement.Attribute("CanGlue").Value; string tip = addControlsRowElement.Attribute("Tip").Value; Actions.Visio_Shape.Populate_Controls_Section(shape, rowName, X, Y, XDynamics, YDynamics, XBehavior, YBehavior, canGlue, tip); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
public static void LayerManager() { VisioHelper.DisplayInWatchWindow(string.Format("{0}({1})", System.Reflection.MethodInfo.GetCurrentMethod().Name, "TODO: Not Implemented")); // TODO(CHR): Launch WPF Layer Manager Window }
internal static async void GetWorkItemInfo(Visio.Shape shape, WorkItemShapeInfo.WorkItemShapeVersion version) { WorkItemShapeInfo shapeInfo = new WorkItemShapeInfo(shape); int id = 0; if (!int.TryParse(shapeInfo.ID, out id)) { MessageBox.Show($"Invalid WorkItem ID: ({shapeInfo.ID})"); return; } var result = await VNC.AZDO.Helper.QueryWorkItemInfoById(shapeInfo.Organization, id); if (result.Count == 0) { MessageBox.Show($"Cannot find WorkItem ID: ({shapeInfo.ID})"); return; } shapeInfo.InitializeFromWorkItem(result[0]); // NOTE(crhodes) // Go add the bugs int bugs = await VNC.AZDO.Helper.QueryRelatedBugsById(shapeInfo.Organization, int.Parse(shapeInfo.ID)); shapeInfo.RelatedBugs = bugs.ToString(); shapeInfo.PopulateShapeDataFromInfo(shape, version); VisioHelper.DisplayInWatchWindow($"{shapeInfo}"); }
public static void AddFooter() { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodBase.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; // TODO: Add some stuff to read from config file with a dialog to default the selection //doc.HeaderLeft = ""; //doc.HeaderCenter = "&n"; //doc.HeaderRight = ""; doc.FooterLeft = "&f&e"; doc.FooterCenter = ""; doc.FooterRight = "&d &p-&P"; var font = doc.HeaderFooterFont; font.Size = (decimal)8; doc.HeaderFooterFont = font; var size = doc.HeaderFooterFont.Size; }
private void ProcessCommand_Page_Delete(XElement pageElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { // TODO(crhodes): // Need to pass in doc so this can work for any document Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; string pageName = pageElement.Attribute("Name").Value; Visio.Page deletePage = doc.Pages[pageName]; if (deletePage != null) { deletePage.Delete(0); } } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_ShapeSheet(Visio.Page page, XElement shapeSheetElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); foreach (XElement element in shapeSheetElement.Elements()) { VisioHlp.DisplayInWatchWindow(element.ToString()); VisioHlp.DisplayInWatchWindow(element.Name.LocalName); switch (element.Name.LocalName) { //case "AddPropRow": // ProcessCommand_ShapeSheet_AddPropRow(shape, element); // break; //case "AddUserRow": // ProcessCommand_ShapeSheet_AddUserRow(shape, element); // break; default: VisioHlp.DisplayInWatchWindow(string.Format("Element >{0}< not supported", element.Name.LocalName)); break; } } }
public static void RenamePages(string searchExpression, string replacementExpression, RegexOptions regexOptions = RegexOptions.None) { VNC.Log.Trace("", Common.LOG_CATEGORY, 0); VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; Visio.Page page = app.ActivePage; Regex regex = new Regex(searchExpression, regexOptions); foreach (Visio.Shape shape in page.Shapes) { VisioHelper.DisplayInWatchWindow(string.Format("Name: {0} Text: {1}", shape.Name, shape.Text)); try { string newPageName = regex.Replace(doc.Pages[shape.Text].Name, replacementExpression); doc.Pages[shape.Text].Name = newPageName; } catch (Exception ex) { Log.Error(ex, Common.LOG_CATEGORY); } } }
private void ProcessCommand_Page_Add(XElement pageElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { // TODO(crhodes): // Need to pass in doc so this can work for any document Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; string newPageName = pageElement.Attribute("Name").Value; string backgroundPageName = pageElement.Attribute("BackgroundPageName").Value; string isBackground = pageElement.Attribute("IsBackground").Value; Visio.Page newPage = Actions.Visio_Page.CreatePage(newPageName, backgroundPageName); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_ShapeSheet_AddUserRow(Visio.Shape shape, XElement addUserRowElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string row = addUserRowElement.Attribute("Row").Value; string value = null; if (addUserRowElement.Attribute("Value") != null) { value = addUserRowElement.Attribute("Value").Value; } else if (addUserRowElement.Attribute("ValueQuoted") != null) { value = string.Format("\"{0}\"", addUserRowElement.Attribute("ValueQuoted").Value); } XAttribute promptAttribute = addUserRowElement.Attribute("Prompt"); if (promptAttribute != null) { Actions.Visio_Shape.Add_User_Row(shape, row, value, promptAttribute.Value); } else { Actions.Visio_Shape.Add_User_Row(shape, row, value); } } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
public static Visio.Page CreateTOCPage() { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodBase.GetCurrentMethod().Name)); Visio.Page page = null; int undoScope = Globals.ThisAddIn.Application.BeginUndoScope("GenerateTOCPage"); try { page = Globals.ThisAddIn.Application.ActiveDocument.Pages["Table of Contents"]; // We found a page, delete it. Not much luck iterating across shapes and clearing page - See ClearPage() page.Delete(0); //ClearPage(page); // Need to delete all the stuff. } catch (Exception ex) { Log.Error(ex, Common.LOG_CATEGORY); } page = Globals.ThisAddIn.Application.ActiveDocument.Pages.Add(); page.NameU = "Table of Contents"; page.Background = 0; page.Index = 1; Globals.ThisAddIn.Application.EndUndoScope(undoScope, true); return(page); }
private void ProcessCommand_Page_Delete(Visio.Document doc, XElement pageElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string pageName = pageElement.Attribute("Name") != null?pageElement.Attribute("Name").Value : ""; if (pageName != "") { Visio.Page deletePage = doc.Pages[pageName]; if (deletePage != null) { deletePage.Delete(0); } else { VisioHlp.DisplayInWatchWindow(string.Format("Page ({0}) not found", pageName)); } } else { VisioHlp.DisplayInWatchWindow("Missing \"Name\" attribute"); } } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
/// <summary> /// For each Shape in Selection, apply Commands /// </summary> /// <param name="shapesElement"></param> private void ProcessCommand_Shapes(IEnumerable <XElement> shapesElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Selection selection = app.ActiveWindow.Selection; foreach (XElement element in shapesElement) { VisioHlp.DisplayInWatchWindow(element.ToString()); VisioHlp.DisplayInWatchWindow(element.Name.LocalName); switch (element.Name.LocalName) { case "Shape": foreach (Visio.Shape shape in selection) { ProcessCommand_Shape(shape, element); } break; default: VisioHlp.DisplayInWatchWindow(string.Format("Element >{0}< not supported", element.Name.LocalName)); break; } } }
private void ProcessCommand_Page(Visio.Document doc, XElement pageElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string pageName = pageElement.Attribute("Name") != null?pageElement.Attribute("Name").Value : ""; string backgroundPageName = pageElement.Attribute("BackgroundPageName") != null?pageElement.Attribute("BackgroundPageName").Value : ""; string isBackground = pageElement.Attribute("IsBackground") != null?pageElement.Attribute("IsBackground").Value : "0"; if ("" != backgroundPageName) { doc.Pages[pageName].BackPage = backgroundPageName; } doc.Pages[pageName].Background = short.Parse(isBackground); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_Layer_Add(Visio.Page page, XElement addElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string layerName = addElement.Attribute("Name").Value; string layerVisible = addElement.Attribute("IsVisible") != null?addElement.Attribute("IsVisible").Value : "1"; string layerPrint = addElement.Attribute("IsPrint") != null?addElement.Attribute("IsPrint").Value : "1"; string layerActive = addElement.Attribute("IsActive") != null?addElement.Attribute("IsActive").Value : "0"; string layerLock = addElement.Attribute("IsLock") != null?addElement.Attribute("IsLock").Value : "0"; string layerSnap = addElement.Attribute("IsSnap") != null?addElement.Attribute("IsSnap").Value : "1"; string layerGlue = addElement.Attribute("IsGlue") != null?addElement.Attribute("IsGlue").Value : "1"; Actions.Visio_Page.AddLayer(page, layerName, layerVisible, layerPrint, layerActive, layerLock, layerSnap, layerGlue); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_Document(XElement documentElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; // TODO(crhodes): // Add some error handling here. Visio.Document doc = app.Documents[documentElement.Attribute("Name").Value]; if (documentElement.Elements("Layers").Any()) { foreach (Visio.Page page in doc.Pages) { ProcessCommand_Layers(page, documentElement.Element("Layers").Elements()); } } if (documentElement.Elements("ShapeSheet").Any()) { ProcessCommand_ShapeSheet(doc, documentElement.Element("ShapeSheet")); } }
private void ProcessCommand_ShapeSheet_SetFillFormat(Microsoft.Office.Interop.Visio.Shape shape, XElement setFillFormatElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string fillForegnd = GetAttributeValueOrNull(setFillFormatElement.Attribute("FillForegnd")); string fillForegndTrans = GetAttributeValueOrNull(setFillFormatElement.Attribute("FillForegndTrans")); string fillBkgnd = GetAttributeValueOrNull(setFillFormatElement.Attribute("FillBkgnd")); string fillBkgndTrans = GetAttributeValueOrNull(setFillFormatElement.Attribute("FillBkgndTrans")); string fillPattern = GetAttributeValueOrNull(setFillFormatElement.Attribute("FillPattern")); string shdwForegnd = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShdwForegnd")); string shdwForegndTrans = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShdwForegndTrans")); string shdwPattern = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShdwPattern")); string shapeShdwOffsetX = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwOffsetX")); string shapeShdwOffsetY = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwOffsetY")); string shapeShdwType = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwType")); string shapeShdwObliqueAngle = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwObliqueAngle")); string shapeShdwScaleFactor = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwScaleFactor")); string shapeShdwBlur = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwBlur")); string shapeShdwShow = GetAttributeValueOrNull(setFillFormatElement.Attribute("ShapeShdwShow")); //attribute = setFillFormatElement.Attribute("FillForegnd"); //if (attribute != null) fillForegnd = setFillFormatElement.Attribute("FillForegnd").Value; //string fillForegndTrans = setFillFormatElement.Attribute("FillForegndTrans").Value; //string fillBkgnd = setFillFormatElement.Attribute("FillBkgnd").Value; //string fillBkgndTrans = setFillFormatElement.Attribute("FillBkgndTrans").Value; //string fillPattern = setFillFormatElement.Attribute("FillPattern").Value; //string shdwForegnd = setFillFormatElement.Attribute("ShdwForegnd").Value; //string shdwForegndTrans = setFillFormatElement.Attribute("ShdwForegndTrans").Value; //string shdwPattern = setFillFormatElement.Attribute("ShdwPattern").Value; //string shapeShdwOffsetX = setFillFormatElement.Attribute("ShapeShdwOffsetX").Value; //string shapeShdwOffsetY = setFillFormatElement.Attribute("ShapeShdwOffsetY").Value; //string shapeShdwType = setFillFormatElement.Attribute("ShapeShdwType").Value; //string shapeShdwObliqueAngle = setFillFormatElement.Attribute("ShapeShdwObliqueAngle").Value; //string shapeShdwScaleFactor = setFillFormatElement.Attribute("ShapeShdwScaleFactor").Value; //string shapeShdwBlur = setFillFormatElement.Attribute("ShapeShdwBlur").Value; //string shapeShdwShow = setFillFormatElement.Attribute("ShapeShdwShow").Value; Actions.Visio_Shape.Set_FillFormat_Section(shape, fillForegnd, fillForegndTrans, fillBkgnd, fillBkgndTrans, fillPattern, shdwForegnd, shdwForegndTrans, shdwPattern, shapeShdwOffsetX, shapeShdwOffsetY, shapeShdwType, shapeShdwObliqueAngle, shapeShdwScaleFactor, shapeShdwBlur, shapeShdwShow); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_Layer_Delete(XElement deleteElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { // TODO(crhodes): // Need to pass in doc and page so this can work for any document Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; Visio.Page page = app.ActivePage; string layerName = deleteElement.Attribute("Name").Value; string deleteShapes = deleteElement.Attribute("DeleteShapes").Value; Actions.Visio_Page.DeleteLayer(page, layerName, short.Parse(deleteShapes)); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_ShapeSheet_ShapeTransform(Microsoft.Office.Interop.Visio.Shape shape, XElement shapeTransformElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string width = GetAttributeValueOrNull(shapeTransformElement.Attribute("Width")); string height = GetAttributeValueOrNull(shapeTransformElement.Attribute("Height")); string pinX = GetAttributeValueOrNull(shapeTransformElement.Attribute("PinX")); string pinY = GetAttributeValueOrNull(shapeTransformElement.Attribute("PinY")); string flipX = GetAttributeValueOrNull(shapeTransformElement.Attribute("FlipX")); string flipY = GetAttributeValueOrNull(shapeTransformElement.Attribute("FlipY")); string locPinX = GetAttributeValueOrNull(shapeTransformElement.Attribute("LocPinX")); string locPinY = GetAttributeValueOrNull(shapeTransformElement.Attribute("LocPinY")); string angle = GetAttributeValueOrNull(shapeTransformElement.Attribute("Angle")); string resizeMode = GetAttributeValueOrNull(shapeTransformElement.Attribute("Angle")); Actions.Visio_Shape.Set_ShapeTransform_Section(shape, width, height, pinX, pinY, flipX, flipY, locPinX, locPinY, angle, resizeMode); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
private void ProcessCommand_Layer_DeleteAll(XElement deleteAllElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { // TODO(crhodes): // Need to pass in doc and page so this can work for any document Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; Visio.Page page = app.ActivePage; foreach (Visio.Layer layer in page.Layers) { layer.Delete(0); } } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
public static void SyncPageNames() { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodBase.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; List <Visio.Page> pagesToUpdate = new List <Microsoft.Office.Interop.Visio.Page>(); VisioHelper.DisplayInWatchWindow(string.Format("Document({0})", doc.Name)); foreach (Visio.Page page in doc.Pages) { if (!page.Name.Equals(page.NameU)) { pagesToUpdate.Add(page); } } foreach (Visio.Page page in pagesToUpdate) { Visio_Page.SyncPageNames(page); } }
private void ProcessCommand_ShapeSheet_SetTextBlockFormat(Microsoft.Office.Interop.Visio.Shape shape, XElement setTextBlockFormatElement) { VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); try { string leftMargin = setTextBlockFormatElement.Attribute("LeftMargin").Value; string topMargin = setTextBlockFormatElement.Attribute("TopMargin").Value; string rightMargin = setTextBlockFormatElement.Attribute("RightMargin").Value; string bottomMargin = setTextBlockFormatElement.Attribute("BottomMargin").Value; string textDirection = setTextBlockFormatElement.Attribute("TextDirection").Value; string verticalAlign = setTextBlockFormatElement.Attribute("VerticalAlign").Value; string textBkgnd = setTextBlockFormatElement.Attribute("TextBkgnd").Value; string textBkgndTrans = setTextBlockFormatElement.Attribute("TextBkgndTrans").Value; string defaultTabStop = setTextBlockFormatElement.Attribute("DefaultTabStop").Value; Actions.Visio_Shape.Set_TextBlockFormat_Section(shape, leftMargin, topMargin, rightMargin, bottomMargin, textDirection, verticalAlign, textBkgnd, textBkgndTrans, defaultTabStop); } catch (Exception ex) { VisioHlp.DisplayInWatchWindow(ex.ToString()); } }
internal static async void GetWorkItemInfo2(Visio.Application app, string doc, string page, string shape, string shapeu, string[] vs) { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", MethodBase.GetCurrentMethod().Name)); Visio.Shape activeShape = app.ActivePage.Shapes[shape]; GetWorkItemInfo(activeShape, WorkItemShapeInfo.WorkItemShapeVersion.V2); }
private static bool VerifyRequiredStencils(Visio.Application app) { bool result = false; result = VisioHelper.LoadStencil(app, "Azure DevOps.vssx"); result = VisioHelper.LoadStencil(app, "Page Shapes.vssx"); return(result); }
public static void DisplayLayer(string layerName, bool show) { VisioHelper.DisplayInWatchWindow(string.Format("{0}(layer:{1} show:{2})", System.Reflection.MethodBase.GetCurrentMethod().Name, layerName, show.ToString())); foreach (Visio.Page page in Globals.ThisAddIn.Application.ActiveDocument.Pages) { Visio_Page.DisplayLayer(page, layerName, show); } }
public static void SortAllPages() { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodBase.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; System.Collections.SortedList sortedPages = new System.Collections.SortedList(); //SortedList<string, string> sortedPages = new SortedList<string, string>(); int index = 0; bool hasTOCPage = false; VisioHelper.DisplayInWatchWindow(string.Format("Document({0})", doc.Name)); try { foreach (Visio.Page page in doc.Pages) { VisioHelper.DisplayInWatchWindow(string.Format("Page({0} IsBackground{1})", page.NameU, page.Background)); if (!page.NameU.Equals("Table of Contents")) { if (page.Background == 0) { sortedPages.Add(page.NameU, page.NameU); index++; } } else { hasTOCPage = true; } //sortedPages.Add(index++, page.NameU); } // If we found a TOC page, start pages off at postion 2, else, postion 1 int offset = hasTOCPage ? 2 : 1; for (int i = 0; i < index; i++) { VisioHelper.DisplayInWatchWindow(string.Format("Moving Page({0})", sortedPages.GetByIndex(i))); doc.Pages.ItemU[sortedPages.GetKey(i)].Index = (short)(i + offset); //Application.ActiveDocument.Pages.ItemU("Page-2").Index = 3 } } catch (Exception ex) { Log.Error(ex, Common.LOG_CATEGORY); } }
public static void DisplayInfo() { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} - {1}\n", "App.Name", app.Name); try { sb.AppendFormat("{0} - {1}\n", "App.ActiveDocument.Name", app.ActiveDocument.Name); } catch (Exception ex) { sb.AppendFormat("{0} - {1}\n", "App.ActiveDocument.Name", "<none>"); } try { sb.AppendFormat("{0} - {1}\n", "App.ActivePage.Name", app.ActivePage.Name); } catch (Exception ex) { sb.AppendFormat("{0} - {1}\n", "App.ActivePage.Name", "<none>"); } sb.AppendFormat("{0} - {1}\n", "App.AddonPaths", app.AddonPaths); sb.AppendFormat("{0} - {1}\n", "App.CommandLine", app.CommandLine); sb.AppendFormat("{0} - {1}\n", "App.Documents.Count", app.Documents.Count); sb.AppendFormat("{0} - {1}\n", "App.DrawingPaths", app.DrawingPaths); sb.AppendFormat("{0} - {1}\n", "App.HelpPaths", app.HelpPaths); sb.AppendFormat("{0} - {1}\n", "App.IsVisio32", app.IsVisio32); sb.AppendFormat("{0} - {1}\n", "App.MyShapesPath", app.MyShapesPath); sb.AppendFormat("{0} - {1}\n", "App.Path", app.Path); sb.AppendFormat("{0} - {1}\n", "App.ProcessID", app.ProcessID); sb.AppendFormat("{0} - {1}\n", "App.ShowChanges", app.ShowChanges); sb.AppendFormat("{0} - {1}\n", "App.ShowProgress", app.ShowProgress); sb.AppendFormat("{0} - {1}\n", "App.ShowStatusBar", app.ShowStatusBar); sb.AppendFormat("{0} - {1}\n", "App.ShowToolBar", app.ShowToolbar); sb.AppendFormat("{0} - {1}\n", "App.StartupPaths", app.StartupPaths); sb.AppendFormat("{0} - {1}\n", "App.StencilPaths", app.StencilPaths); sb.AppendFormat("{0} - {1}\n", "App.TemplatePaths", app.TemplatePaths); sb.AppendFormat("{0} - {1}\n", "App.TraceFlags", app.TraceFlags); sb.AppendFormat("{0} - {1}\n", "App.UndoEnables", app.UndoEnabled); sb.AppendFormat("{0} - {1}\n", "App.UserName", app.UserName); sb.AppendFormat("{0} - {1}\n", "App.Version", app.Version); //System.Windows.Forms.MessageBox.Show(sb.ToString()); VisioHelper.DisplayInWatchWindow(sb.ToString()); }
private void ProcessCommand_Documents(IEnumerable <XElement> documentsElement) { // <Documents> // <Add /> // <ActiveDocument> // <Layers> // <DeleteAll /> - Not sure if can do this // <Delete Name = "" /> // <Add Name = "Layer1" IsVisible = "true" IsPrint = "true" IsActive = "true" IsLock = "true" IsSnap = "true" IsGlue = "true" Color = "" /> // </Layers> // </ActiveDocument> // </Documents> VisioHlp.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodInfo.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; foreach (XElement element in documentsElement) { VisioHlp.DisplayInWatchWindow(element.ToString()); VisioHlp.DisplayInWatchWindow(element.Name.LocalName); switch (element.Name.LocalName) { case "Add": ProcessCommand_Document_Add(element); break; case "ActiveDocument": ProcessCommand_ActiveDocument(element); break; case "Document": ProcessCommand_Document(element); break; case "Layers": foreach (Visio.Page page in doc.Pages) { ProcessCommand_Layers(page, element.Elements()); } break; default: VisioHlp.DisplayInWatchWindow(string.Format("Element >{0}< not supported", element.Name.LocalName)); break; } } }
internal static void GetMethodInfo(Visio.Application app, string doc, string page, string shape, string shapeu, string[] v) { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", MethodBase.GetCurrentMethod().Name)); Visio.Page activePage = app.ActivePage; Visio.Shape activeShape = app.ActivePage.Shapes[shape]; MethodInfoShape methodInfoShape = new MethodInfoShape(activeShape); VisioHelper.DisplayInWatchWindow(string.Format("{0}", methodInfoShape.ToString())); }
public static void GetClassInfo(Visio.Application app, string doc, string page, string shape, string shapeu, String[] args) { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", MethodBase.GetCurrentMethod().Name)); Visio.Page activePage = app.ActivePage; Visio.Shape activeShape = app.ActivePage.Shapes[shape]; ClassInfoShape classInfoShape = new ClassInfoShape(activeShape); VisioHelper.DisplayInWatchWindow(string.Format("{0}", classInfoShape.ToString())); }
public static void RemoveLayers() { VisioHelper.DisplayInWatchWindow(string.Format("{0}()", System.Reflection.MethodBase.GetCurrentMethod().Name)); Visio.Application app = Globals.ThisAddIn.Application; Visio.Document doc = app.ActiveDocument; foreach (Visio.Page page in doc.Pages) { Visio_Page.DeleteLayers(page); } }