private async void ActiveContainer_Changed(object sender, ContainerChangedEventArgs e) { var activeContainer = e.ActiveContainer; // Anytime the container changes, Type targetType = activeContainer?.DefaultView; if (targetType != null && targetType != this.ListContentView.GetType()) { // If no original view is stored in stashedContentView then store a reference before the switch if (stashedContentView == null) { stashedContentView = this.ListContentView; } // If the current view doesn't match the view requested by the container, construct and switch to the requested view var targetView = Activator.CreateInstance(targetType) as GuiWidget; if (targetView != null) { this.ListContentView = targetView; } } else if (stashedContentView != null) { // Switch back to the original view this.ListContentView = stashedContentView; stashedContentView = null; } await DisplayContainerContent(activeContainer); }
private void Library_ContainerChanged(object sender, ContainerChangedEventArgs e) { // Release if (e.PreviousContainer != null) { e.PreviousContainer.ContentChanged -= UpdateStatus; } var activeContainer = this.libraryView.ActiveContainer; bool containerSupportsEdits = activeContainer is ILibraryWritableContainer; var owningNode = libraryTreeView.SelectedNode?.Parents <ContainerTreeNode>().Where(p => p.Container == activeContainer).FirstOrDefault(); if (owningNode != null) { libraryTreeView.SelectedNode = owningNode; } // searchInput.Text = activeContainer.KeywordFilter; breadCrumbWidget.SetContainer(activeContainer); activeContainer.ContentChanged += UpdateStatus; searchButton.Enabled = activeContainer.Parent != null; UpdateStatus(null, null); }
private void Library_ContainerChanged(object sender, ContainerChangedEventArgs e) { // Release if (e.PreviousContainer != null) { e.PreviousContainer.ContentChanged -= UpdateStatus; } var activeContainer = this.libraryView.ActiveContainer; bool containerSupportsEdits = activeContainer is ILibraryWritableContainer; //searchInput.Text = activeContainer.KeywordFilter; breadCrumbWidget.SetContainer(activeContainer); activeContainer.ContentChanged += UpdateStatus; searchButton.Enabled = activeContainer.Parent != null; UpdateStatus(null, null); }