Keep show folders open if opened

This commit is contained in:
Lars Brubaker 2017-09-01 17:41:43 -07:00
parent 32195ccdb4
commit 3504c57c77
4 changed files with 13 additions and 15 deletions

View file

@ -85,8 +85,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
}, ref unregisterEvents);
}
public bool ShowContainers { get; set; } = true;
public bool ShowItems { get; set; } = true;
public Predicate<ILibraryContainerLink> ContainerFilter { get; set; } = (o) => true;
@ -168,7 +166,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
int height = itemsContentView.ThumbHeight;
// Folder items
if (this.ShowContainers)
if (UserSettings.Instance.get("ShowContainers") == "1")
{
foreach (var childContainer in sourceContainer.ChildContainers.Where(c => c.IsVisible && this.ContainerFilter(c)))
{

View file

@ -78,7 +78,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
libraryView = new ListView(ApplicationController.Instance.Library)
{
BackgroundColor = ActiveTheme.Instance.TertiaryBackgroundColor,
ShowContainers = false
};
libraryView.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
@ -94,11 +93,11 @@ namespace MatterHackers.MatterControl.PrintLibrary
CheckBox showFolders = new CheckBox("Folders")
{
Name = "Show Folders Toggle",
Checked = libraryView.ShowContainers
Checked = UserSettings.Instance.get("ShowContainers") == "1"
};
showFolders.CheckedStateChanged += (s, e) =>
{
libraryView.ShowContainers = showFolders.Checked;
UserSettings.Instance.set("ShowContainers", showFolders.Checked ? "1" : "0");
libraryView.Reload();
};
allControls.AddChild(showFolders);