Example #1
0
 internal virtual void OnDocumentSaved(Controls.DocControl cont, DocumentSavedEventArgs doc)
 {
     if (DocumentSaved != null)
     {
         DocumentSaved.DynamicInvoke(new object[] { cont, doc });
     }
 }
Example #2
0
        /// <summary>
        /// Save document safely. "Safe" in the sense that all exceptions are caught (and reported via OnSaveException).
        /// The implementer of IDocumentClient is responsible for ensuring that existing data is not lost
        /// if the save fails.</summary>
        /// <param name="document">Document to save</param>
        /// <param name="kind">Kind of document event associated with save</param>
        /// <returns>True iff document is saved safely</returns>
        protected bool SafeSave(IDocument document, DocumentEventType kind)
        {
            IsSaving = true;

            bool success = false;

            try
            {
                if (OnDocumentSaving(document))
                {
                    DocumentSaving.Raise(this, new DocumentEventArgs(document, kind));

                    IDocumentClient client = GetClient(document);
                    client.Save(document, document.Uri);

                    success = OnDocumentSaved(document);

                    if (success)
                    {
                        document.Dirty = false;
                        m_newDocumentPaths.Remove(document.Uri.LocalPath);
                        DocumentSaved.Raise(this, new DocumentEventArgs(document, kind));
                    }
                }
            }
            catch (Exception ex)
            {
                OnSaveException(ex);
            }

            IsSaving = false;

            return(success);
        }
Example #3
0
        public int OnAfterSave(uint docCookie)
        {
            var info = _runningDocumentTable.GetDocumentInfo(docCookie);
            var path = info.Moniker;

            DocumentSaved?.Invoke(this, path);
            return(VSConstants.S_OK);
        }
Example #4
0
        private async void HandleDocumentSaved(object sender, EventArgs e)
        {
            var analysedDocument = await GetAnalysisDocument();

            if (analysedDocument != null)
            {
                DocumentSaved?.Invoke(this, new DocumentSavedEventArgs {
                    Document = analysedDocument
                });
            }
        }
        private void DocumentEvents_DocumentSaved(Document document)
        {
            var analysedDocument = GetAnalysisDocument(document);

            if (analysedDocument != null)
            {
                DocumentSaved?.Invoke(this, new DocumentSavedEventArgs {
                    Document = analysedDocument
                });
            }
        }
        private void SaveDocument()
        {
            ChangeStatus(ServiceActivity.Saving);

            try
            {
                var sequence        = Interlocked.Exchange(ref _sequenceFileNames, new ConcurrentBag <string>());
                var destinationPath = _pdfService.SaveDocument(sequence.Reverse(), GenerateUniqueFileName());

                if (destinationPath != null)
                {
                    DocumentSaved?.Invoke(this, new DocumentEventArgs(destinationPath));
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex.Message);
                throw;
            }

            ChangeStatus(ServiceActivity.Waiting);
        }
Example #7
0
 /// <summary>
 /// Invokes handlers of the <see cref="DocumentSaved"/> event.
 /// </summary>
 /// <param name="document">The saved document.</param>
 protected void NotifyDocumentSaved(IDocument document)
 {
     DocumentSaved?.Invoke(this, new DocumentWindowEventArgs(document));
 }
Example #8
0
 public static void RaiseDocumentSaved(Document document)
 {
     DocumentSaved?.Invoke(document);
 }
Example #9
0
 private void OnCurrentDocumentSaved(object sender, EventArgs e)
 {
     DocumentSaved?.Invoke(sender, e);
 }
Example #10
0
 protected virtual void OnDocumentSaved(DevEnviromentDocument e)
 {
     DocumentSaved?.Invoke(this, e);
 }
Example #11
0
 public int OnAfterSave(uint docCookie)
 {
     DocumentSaved?.Invoke(docCookie);
     return(VSConstants.S_OK);
 }
Example #12
0
 public void FakeNotification()
 {
     DocumentSaved.Invoke(new Document());
 }