Ejemplo n.º 1
0
        protected override void ProcessRecord()
        {
            var targetdocs = new VisioScripting.TargetDocuments(this.Documents);

            targetdocs.Resolve(this.Client);
            this.Client.Document.CloseDocuments(targetdocs, this.Force);
        }
        public void CloseDocument(VisioScripting.TargetDocuments targetdocs)
        {
            bool force = true;

            targetdocs = targetdocs.ResolveToDocuments(this._client);

            this._client.Output.WriteVerbose("Closing {0} documents", targetdocs.Documents.Count);

            if (targetdocs.Documents.Count < 1)
            {
                return;
            }

            var app = targetdocs.Documents[0].Application;

            var code = VisioAutomation.Application.AlertResponseCode.No;

            using (var alert = new VisioAutomation.Application.AlertResponseScope(app, code))
            {
                foreach (var doc in targetdocs.Documents)
                {
                    this._client.Output.WriteVerbose("Closing doc with ID={0} Name={1}", doc.ID, doc.Name);
                    doc.Close(force);
                }
            }
        }
 public void CloseDocuments(VisioScripting.TargetDocuments targetdocs, bool force)
 {
     this._client.Output.WriteVerbose("Closing {0} documents", targetdocs.Documents.Count);
     foreach (var target_doc in targetdocs.Documents)
     {
         this._client.Output.WriteVerbose("Closing doc with ID={0} Name={1}", target_doc.ID, target_doc.Name);
         target_doc.Close(force);
     }
 }
        public void CloseAllDocumentsWithoutSaving()
        {
            var cmdtarget = this._client.GetCommandTarget(CommandTargetFlags.RequireApplication);

            var all_documents = cmdtarget.Application.Documents.ToList();
            var drawing_docs  = all_documents.Where(doc => doc.Type == IVisio.VisDocumentTypes.visTypeDrawing).ToList();

            var targetdocs = new VisioScripting.TargetDocuments(drawing_docs);

            this.CloseDocument(targetdocs);
        }