Ejemplo n.º 1
0
 /// <summary>
 /// Open a document into the view.
 /// </summary>
 /// <remarks>
 /// Open does not involve fetching the document, it merely opens the
 /// document into the controller.
 /// </remarks>
 /// <param name="document">Document to be opened.</param>
 public void OpenDocument(AbstractDocument document)
 {
     if (!Documents.Contains(document))
     {
         Documents.Add(document);
     }
     CurrentDocument = document;
     OnDocumentOpened(this, new DataEventArgs <AbstractDocument>(document));
 }
Ejemplo n.º 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));
            }
        }
 public DocumentClosingEventArgs(AbstractDocument doc, bool cancel)
     : base(cancel)
 {
     this.Document = doc;
 }
 /// <summary>
 /// Creates a new instance of <c>DocumentClosingEventArgs</c>.
 /// </summary>
 public DocumentClosingEventArgs(AbstractDocument doc)
     : this(doc, false)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Open a document into the view.
 /// </summary>
 /// <remarks>
 /// Open does not involve fetching the document, it merely opens the
 /// document into the controller.
 /// </remarks>
 /// <param name="document">Document to be opened.</param>
 public void OpenDocument(AbstractDocument document)
 {
     if (!Documents.Contains(document)) {
         Documents.Add(document);
     }
     CurrentDocument = document;
     OnDocumentOpened(this, new DataEventArgs<AbstractDocument>(document));
 }
Ejemplo n.º 6
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));
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a new instance of <c>DocumentClosingEventArgs</c>.
 /// </summary>
 /// <param name="doc">Document that is being closed.</param>
 /// <param name="cancel">
 /// True to default the <see cref="Cancel"/> state.
 /// </param>
 public DocumentClosingEventArgs(AbstractDocument doc, bool cancel)
     : base(cancel)
 {
     this.Document = doc;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates a new instance of <c>DocumentClosingEventArgs</c>.
 /// </summary>
 /// <param name="doc">Document that is being closed.</param>
 public DocumentClosingEventArgs(AbstractDocument doc)
     : this(doc, false)
 {
 }