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 Application.AlertResponseScope(application, Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
Example #2
0
        public static void Close(IVisio.Document doc, bool force_close)
        {
            if (force_close)
            {
                var new_alert_response = Application.AlertResponseCode.No;
                var app = doc.Application;

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

            using (var alert = new Application.AlertResponseScope(application, 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 = Application.AlertResponseCode.No;
                var app = doc.Application;

                using (var alertresponse = new Application.AlertResponseScope(app,new_alert_response))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
        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 Application.AlertResponseScope(application, Application.AlertResponseCode.No))
                {
                    doc.Close();
                }
            }
            else
            {
                doc.Close();
            }
        }
        public void CloseAllWithoutSaving()
        {
            this.Client.Application.AssertApplicationAvailable();
            var application = this.Client.Application.Get();
            var documents = application.Documents;
            var docs = documents.AsEnumerable().Where(doc => doc.Type == IVisio.VisDocumentTypes.visTypeDrawing).ToList();

            using (var alert = new Application.AlertResponseScope(application, 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();
                }
            }
        }