protected void OnDocumentClosing(object sender, DocumentClosingEventArgs args) { if (DocumentClosing != null) { DocumentClosing(sender, args); } }
/// <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)); } }
/// <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); } }
/// <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)); } }