protected void OnDocumentClosing(object sender, DocumentClosingEventArgs args) { if (DocumentClosing != null) { DocumentClosing(sender, args); } }
public void CloseDocument(DocumentBase document) { if (Documents.Contains(document)) { DocumentClosingEventArgs closeArgs = new DocumentClosingEventArgs(document); OnDocumentClosing(this, closeArgs); if (closeArgs.Cancel) { return; } if (document.Equals(CurrentDocument)) { CurrentDocument = null; } Documents.Remove(document); document.Dispose(); OnDocumentClosed(this, new DataEventArgs<DocumentBase>(document)); } }