Exemple #1
0
 /// <summary>
 /// loads the stencils for the model network
 /// </summary>
 public void LoadShapes()
 {
     //load in shapes
     try
     {
         //check if current opening document is not on the shape list
         if (!ShapeTemplateFiles.Any(t => this._visioApplication.Documents.Any(c => c.Name == t)) && !_visioApplication.ActiveDocument.Name.Contains(".vsx") && !_visioApplication.ActiveDocument.Name.Contains(".vssx"))
         {
             //cycle all files that have to be opened
             foreach (var file in ShapeTemplateFiles)
             {
                 //check if already opened, if not -> open
                 if (!this._visioApplication.Documents.Any(t => t.Name == file))
                 {
                     this._visioApplication.Documents.OpenEx(file, (short)NetOffice.VisioApi.Enums.VisOpenSaveArgs.visOpenDocked | (short)NetOffice.VisioApi.Enums.VisOpenSaveArgs.visOpenRO);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         NotifyErrorReceived(ex);
     }
 }
Exemple #2
0
 /// <summary>
 /// unloads the model network specific stencils
 /// </summary>
 public void UnloadShapes()
 {
     try
     {
         List <IVDocument> documents = this._visioApplication.Documents.Where(t => ShapeTemplateFiles.Any(c => c == t.Name)).ToList();
         for (int i = 0; i < documents.Count; i++)
         {
             documents[i].Close();
         }
     }
     catch (Exception ex)
     {
         NotifyErrorReceived(ex);
     }
 }