Example #1
0
 protected void OnDocumentClosing(object sender, DocumentClosingEventArgs args)
 {
     if (DocumentClosing != null)
     {
         DocumentClosing(sender, args);
     }
 }
Example #2
0
        /// <summary>
        /// Remove a document from the view.
        /// </summary>
        /// Close does not involve saving the document, it merely removes the
        /// document from the controller.
        /// <param name="document">Document to be removed.</param>
        public void CloseDocument(AbstractDocument document)
        {
            if (Documents.Contains(document))
            {
                DocumentClosingEventArgs closeArgs = new DocumentClosingEventArgs(document);

                OnDocumentClosing(this, closeArgs);
                if (closeArgs.Cancel)
                {
                    //TODO: Work out the best way to handle this.
                    return;
                }

                if (document.Equals(CurrentDocument))
                {
                    CurrentDocument = null;
                }
                Documents.Remove(document);
                OnDocumentClosed(this, new DataEventArgs <AbstractDocument>(document));
            }
        }
Example #3
0
 /// <summary>
 /// Raises the <see cref="DocumentClosing"/> event.
 /// </summary>
 /// <param name="sender">Calling object</param>
 /// <param name="args">Event arguments.</param>
 protected void OnDocumentClosing(object sender, DocumentClosingEventArgs args)
 {
     if (DocumentClosing != null) {
         DocumentClosing(sender, args);
     }
 }
Example #4
0
        /// <summary>
        /// Remove a document from the view.
        /// </summary>
        /// Close does not involve saving the document, it merely removes the
        /// document from the controller.
        /// <param name="document">Document to be removed.</param>
        public void CloseDocument(AbstractDocument document)
        {
            if (Documents.Contains(document)) {
                DocumentClosingEventArgs closeArgs = new DocumentClosingEventArgs(document);

                OnDocumentClosing(this, closeArgs);
                if (closeArgs.Cancel) {
                    //TODO: Work out the best way to handle this.
                    return;
                }

                if (document.Equals(CurrentDocument)) {
                    CurrentDocument = null;
                }
                Documents.Remove(document);
                OnDocumentClosed(this, new DataEventArgs<AbstractDocument>(document));
            }
        }