示例#1
0
        private void CreateNewDocument(DockWindowViewModel dockWindowViewModel)
        {
            dockWindowViewModel.PropertyChanged += DockWindowViewModel_PropertyChanged;

            if (!dockWindowViewModel.IsClosed)
            {
                this.Documents.Add(dockWindowViewModel);
            }
        }
示例#2
0
        private void DockWindowViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            DockWindowViewModel document = sender as DockWindowViewModel;

            if (e.PropertyName == nameof(DockWindowViewModel.IsClosed))
            {
                if (!document.IsClosed)
                {
                    this.Documents.Add(document);
                }
                else
                {
                    this.Documents.Remove(document);

                    if (Documents.Count == 0)
                    {
                        ActiveDockWindow = null;
                    }
                }
            }
        }