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 Close(bool force)
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            var application = this._client.Application.Get();
            var doc         = application.ActiveDocument;

            if (doc.Type != IVisio.VisDocumentTypes.visTypeDrawing)
            {
                this._client.WriteVerbose("Not a Drawing Window", doc.Name);
                throw new AutomationException("Not a Drawing Window");
            }

            this._client.WriteVerbose("Closing Document Name=\"{0}\"", doc.Name);
            this._client.WriteVerbose("Closing Document FullName=\"{0}\"", doc.FullName);

            if (force)
            {
                using (var alert = new VisioAutomation.Application.AlertResponseScope(application, VisioAutomation.Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
        public void CloseDocument(TargetDocument targetdoc, bool force)
        {
            targetdoc = targetdoc.Resolve(this._client);


            var doc = targetdoc.Document;
            var app = doc.Application;

            if (doc.Type != IVisio.VisDocumentTypes.visTypeDrawing)
            {
                this._client.Output.WriteVerbose("Not a Drawing Window", doc.Name);
                throw new System.ArgumentException("Not a Drawing Window");
            }

            this._client.Output.WriteVerbose("Closing Document Name=\"{0}\"", doc.Name);
            this._client.Output.WriteVerbose("Closing Document FullName=\"{0}\"", doc.FullName);

            if (force)
            {
                using (var alert = new VisioAutomation.Application.AlertResponseScope(app, VisioAutomation.Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
        public void Close(bool force)
        {
            this.AssertApplicationAvailable();
            this.AssertDocumentAvailable();

            var application = this.Client.VisioApplication;
            var doc = application.ActiveDocument;

            if (doc.Type != IVisio.VisDocumentTypes.visTypeDrawing)
            {
                this.Client.WriteVerbose("Not a Drawing Window", doc.Name);
                throw new VA.AutomationException("Not a Drawing Window");
            }

            this.Client.WriteVerbose( "Closing Document Name=\"{0}\"", doc.Name);
            this.Client.WriteVerbose( "Closing Document FullName=\"{0}\"", doc.FullName);

            if (force)
            {
                using (var alert = new VA.Application.AlertResponseScope(application, VA.Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
示例#5
0
        public void CloseActiveDocument(bool force)
        {
            var cmdtarget = this._client.GetCommandTargetDocument();

            var doc = cmdtarget.ActiveDocument;

            if (doc.Type != IVisio.VisDocumentTypes.visTypeDrawing)
            {
                this._client.Output.WriteVerbose("Not a Drawing Window", doc.Name);
                throw new System.ArgumentException("Not a Drawing Window");
            }

            this._client.Output.WriteVerbose("Closing Document Name=\"{0}\"", doc.Name);
            this._client.Output.WriteVerbose("Closing Document FullName=\"{0}\"", doc.FullName);

            if (force)
            {
                using (var alert = new VisioAutomation.Application.AlertResponseScope(cmdtarget.Application, VisioAutomation.Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
示例#6
0
 public IVisio.Document TryOpen(IVisio.Documents docs, string filename)
 {
     using (var scope = new VA.Application.AlertResponseScope(docs.Application, VA.Application.AlertResponseCode.No))
     {
         var doc = docs.Open(filename);
         return doc;
     }
 }
示例#7
0
 public IVisio.Document TryOpen(IVisio.Documents docs, string filename)
 {
     using (var scope = new VA.Application.AlertResponseScope(docs.Application, VA.Application.AlertResponseCode.No))
     {
         var doc = docs.Open(filename);
         return(doc);
     }
 }
        public void CloseAllDocumentsWithoutSaving()
        {
            var cmdtarget = this._client.GetCommandTargetApplication();
            var documents = cmdtarget.Application.Documents;
            var docs      = documents.ToEnumerable().Where(doc => doc.Type == IVisio.VisDocumentTypes.visTypeDrawing).ToList();

            using (var alert = new VisioAutomation.Application.AlertResponseScope(cmdtarget.Application, VisioAutomation.Application.AlertResponseCode.No))
            {
                foreach (var doc in docs)
                {
                    this._client.Output.WriteVerbose("Closing Document Name=\"{0}\"", doc.Name);
                    this._client.Output.WriteVerbose("Closing Document FullName=\"{0}\"", doc.FullName);
                    doc.Close();
                }
            }
        }
示例#9
0
        public void CloseAllWithoutSaving()
        {
            this.AssertApplicationAvailable();
            var application = this.Client.VisioApplication;
            var documents   = application.Documents;
            var docs        = documents.AsEnumerable().Where(doc => doc.Type == IVisio.VisDocumentTypes.visTypeDrawing).ToList();

            using (var alert = new VA.Application.AlertResponseScope(application, VA.Application.AlertResponseCode.No))
            {
                foreach (var doc in docs)
                {
                    this.Client.WriteVerbose("Closing Document Name=\"{0}\"", doc.Name);
                    this.Client.WriteVerbose("Closing Document FullName=\"{0}\"", doc.FullName);
                    doc.Close();
                }
            }
        }
        public static void Close(IVisio.Document doc, bool force_close)
        {
            if (force_close)
            {
                var new_alert_response = VA.Application.AlertResponseCode.No;
                var app = doc.Application;

                using (var alertresponse = new VA.Application.AlertResponseScope(app,new_alert_response))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
示例#11
0
        public static void Close(IVisio.Document doc, bool force_close)
        {
            if (force_close)
            {
                var new_alert_response = VA.Application.AlertResponseCode.No;
                var app = doc.Application;

                using (var alertresponse = new VA.Application.AlertResponseScope(app, new_alert_response))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
        public void CloseAllWithoutSaving()
        {
            this.AssertApplicationAvailable();
            var application = this.Client.VisioApplication;
            var documents = application.Documents;
            var docs = documents.AsEnumerable().Where(doc => doc.Type == IVisio.VisDocumentTypes.visTypeDrawing).ToList();

            using (var alert = new VA.Application.AlertResponseScope(application, VA.Application.AlertResponseCode.No))
            {
                foreach (var doc in docs)
                {
                    this.Client.WriteVerbose( "Closing Document Name=\"{0}\"", doc.Name);
                    this.Client.WriteVerbose( "Closing Document FullName=\"{0}\"", doc.FullName);
                    doc.Close();
                }
            }
        }