From f6cddb646fa44b8ce4e018b1de3dfe0de61635ba Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 12 Dec 2018 17:42:47 -0800 Subject: [PATCH] Only pass workspace into LibraryListView, use workspace context - Fix broken breadcrumbs --- MatterControlLib/Library/Widgets/PrintLibraryWidget.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MatterControlLib/Library/Widgets/PrintLibraryWidget.cs b/MatterControlLib/Library/Widgets/PrintLibraryWidget.cs index 298467634..86e7e47ac 100644 --- a/MatterControlLib/Library/Widgets/PrintLibraryWidget.cs +++ b/MatterControlLib/Library/Widgets/PrintLibraryWidget.cs @@ -60,6 +60,7 @@ namespace MatterHackers.MatterControl.PrintLibrary private ThemeConfig theme; private OverflowBar navBar; private GuiWidget searchButton; + private PartWorkspace workspace; public PrintLibraryWidget(MainViewWidget mainViewWidget, PartWorkspace workspace, ThemeConfig theme, PopupMenuButton popupMenuButton) { @@ -67,10 +68,11 @@ namespace MatterHackers.MatterControl.PrintLibrary this.mainViewWidget = mainViewWidget; this.Padding = 0; this.AnchorAll(); + this.workspace = workspace; var allControls = new FlowLayoutWidget(FlowDirection.TopToBottom); - libraryView = new LibraryListView(workspace.LibraryView, workspace.Printer, theme) + libraryView = new LibraryListView(workspace.LibraryView, theme) { Name = "LibraryView", // Drop containers if ShowContainers != 1 @@ -81,7 +83,7 @@ namespace MatterHackers.MatterControl.PrintLibrary libraryView.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged; - ApplicationController.Instance.Library.ContainerChanged += Library_ContainerChanged; + workspace.LibraryView.ContainerChanged += Library_ContainerChanged; navBar = new OverflowBar(theme) { @@ -430,7 +432,9 @@ namespace MatterHackers.MatterControl.PrintLibrary if (libraryView?.ActiveContainer != null) { libraryView.ActiveContainer.ContentChanged -= UpdateStatus; - ApplicationController.Instance.Library.ContainerChanged -= Library_ContainerChanged; + libraryView.SelectedItems.CollectionChanged -= SelectedItems_CollectionChanged; + + workspace.LibraryView.ContainerChanged -= Library_ContainerChanged; } base.OnClosed(e);