private void DockingManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { var manager = (DockingManager)sender; if (LayoutDocuments.Children.Count == 0 && manager.FloatingWindows.ToList().Count == 0) _countWorkArea = 0; }
private void OnDockingManagerDocumentClosed(object sender, DocumentClosedEventArgs e) { var control = e.Document.Content as BaseStudioControl; if (control == null) return; _documents.RemoveWhere(p => Equals(p.Value, e.Document)); _isLayoutChanged = true; _changedControls.Remove(control); _dockingControlSettings.Remove(control); Flush(); }
private void DocumentClosedExecute(DocumentClosedEventArgs arg) { // Avalon Dock desactive les view quand on les ferme mais ne les retire pas du région manager .... // certainement pour les recycler if (arg.Document != null && arg.Document is LayoutDocument) { LayoutDocument document = arg.Document as LayoutDocument; if (document.Content != null) { IRegion region = this._regionManager.Regions["TabRegion"]; if (region.Views.Contains(document.Content)) {region.Remove(document.Content);} if (document.Content is IDisposable) {(document.Content as IDisposable).Dispose(); } GC.SuppressFinalize(document.Content); } } }
internal void _ExecuteCloseCommand(LayoutDocument document) { if (DocumentClosing != null) { var evargs = new DocumentClosingEventArgs(document); DocumentClosing(this, evargs); if (evargs.Cancel) return; } if (!document.TestCanClose()) return; document.Close(); if (DocumentClosed != null) { var evargs = new DocumentClosedEventArgs(document); DocumentClosed(this, evargs); } }
/// <summary> /// Updates the Views collection in the Region whenever a Document is closed. /// </summary> private void DockingManager_DocumentClosed(object sender, DocumentClosedEventArgs e) { LayoutDocument layoutDocument = e.Document; if (layoutDocument == null) { return; } if (Region.Views.Contains(layoutDocument)) { Region.Remove(layoutDocument); } if (Region.Views.Contains(layoutDocument.Content)) { Region.Remove(layoutDocument.Content); } var fElement = layoutDocument.Content as FrameworkElement; if (fElement == null) { return; } if (Region.Views.Contains(fElement)) { Region.Remove(fElement); } if (Region.Views.Contains(fElement.DataContext)) { Region.Remove(fElement.DataContext); } }