Moving show folders to the menu

refactoring
This commit is contained in:
Lars Brubaker 2020-07-24 14:03:45 -07:00
parent 3431651654
commit 32b8776276
11 changed files with 20 additions and 9 deletions

View file

@ -51,6 +51,8 @@ namespace MatterHackers.MatterControl
public string Name => _libraryContainer.Name; public string Name => _libraryContainer.Name;
public string CollectionKeyName { get; set; }
public string StatusMessage => _libraryContainer.StatusMessage; public string StatusMessage => _libraryContainer.StatusMessage;
public bool IsProtected => _libraryContainer.IsProtected; public bool IsProtected => _libraryContainer.IsProtected;

View file

@ -60,6 +60,8 @@ namespace MatterHackers.MatterControl.Library
event EventHandler ContentChanged; event EventHandler ContentChanged;
string CollectionKeyName { get; }
List<ILibraryContainerLink> ChildContainers { get; } List<ILibraryContainerLink> ChildContainers { get; }
List<ILibraryItem> Items { get; } List<ILibraryItem> Items { get; }

View file

@ -35,6 +35,7 @@ namespace MatterHackers.MatterControl.Library
public interface ILibraryContainerLink : ILibraryItem public interface ILibraryContainerLink : ILibraryItem
{ {
Task<ILibraryContainer> GetContainer(Action<double, string> reportProgress); Task<ILibraryContainer> GetContainer(Action<double, string> reportProgress);
bool IsReadOnly { get; } bool IsReadOnly { get; }
} }
} }

View file

@ -36,7 +36,9 @@ namespace MatterHackers.MatterControl.Library
public class DynamicContainerLink : ILibraryContainerLink, IThumbnail public class DynamicContainerLink : ILibraryContainerLink, IThumbnail
{ {
public string ID { get; set; } public string ID { get; set; }
public string Category { get; set; } public string Category { get; set; }
public bool IsProtected { get; set; } = true; public bool IsProtected { get; set; } = true;
public bool IsReadOnly { get; set; } = false; public bool IsReadOnly { get; set; } = false;
@ -52,7 +54,7 @@ namespace MatterHackers.MatterControl.Library
private ImageBuffer microIcon; private ImageBuffer microIcon;
public DynamicContainerLink(Func<string> nameResolver, ImageBuffer microIcon, ImageBuffer thumbnail, Func<ILibraryContainer> creator = null, Func<bool> visibilityResolver = null) public DynamicContainerLink(Func<string> nameResolver, ImageBuffer microIcon, ImageBuffer thumbnail, Func<ILibraryContainer> creator = null, Func<bool> visibilityResolver = null)
: this (nameResolver, thumbnail, creator, visibilityResolver) : this(nameResolver, thumbnail, creator, visibilityResolver)
{ {
this.microIcon = microIcon; this.microIcon = microIcon;
} }

View file

@ -44,6 +44,8 @@ namespace MatterHackers.MatterControl.Library
public string Name { get; set; } public string Name { get; set; }
public string CollectionKeyName { get; set; }
public Type DefaultView { get; protected set; } public Type DefaultView { get; protected set; }
public List<ILibraryContainerLink> ChildContainers { get; set; } = new List<ILibraryContainerLink>(); public List<ILibraryContainerLink> ChildContainers { get; set; } = new List<ILibraryContainerLink>();

View file

@ -51,6 +51,8 @@ namespace MatterHackers.MatterControl.Library
public string ID { get; } = "rootLibraryProvider"; public string ID { get; } = "rootLibraryProvider";
public string CollectionKeyName { get; set; }
public string Name => "Home".Localize(); public string Name => "Home".Localize();
public bool IsProtected => true; public bool IsProtected => true;

View file

@ -83,7 +83,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
{ {
Name = "LibraryView", Name = "LibraryView",
// Drop containers if ShowContainers != 1 // Drop containers if ShowContainers != 1
ContainerFilter = (container) => UserSettings.Instance.ShowContainers,
BackgroundColor = theme.BackgroundColor, BackgroundColor = theme.BackgroundColor,
Border = new BorderDouble(top: 1), Border = new BorderDouble(top: 1),
DoubleClickAction = LibraryListView.DoubleClickActions.PreviewItem DoubleClickAction = LibraryListView.DoubleClickActions.PreviewItem
@ -657,7 +656,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
menuActions.Add(new LibraryAction(ActionScope.ListView) menuActions.Add(new LibraryAction(ActionScope.ListView)
{ {
Title = "Create Folder".Localize(), Title = "Create Folder...".Localize(),
Icon = AggContext.StaticData.LoadIcon("fa-folder-new_16.png", 16, 16, ApplicationController.Instance.MenuTheme.InvertIcons), Icon = AggContext.StaticData.LoadIcon("fa-folder-new_16.png", 16, 16, ApplicationController.Instance.MenuTheme.InvertIcons),
Action = (selectedLibraryItems, listView) => Action = (selectedLibraryItems, listView) =>
{ {

View file

@ -77,7 +77,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
{ {
Name = "LibraryView", Name = "LibraryView",
// Drop containers if ShowContainers != 1 // Drop containers if ShowContainers != 1
ContainerFilter = (container) => UserSettings.Instance.ShowContainers,
BackgroundColor = libraryBackground, BackgroundColor = libraryBackground,
Border = new BorderDouble(top: 1) Border = new BorderDouble(top: 1)
}; };

View file

@ -53,6 +53,7 @@ namespace MatterHackers.MatterControl
{ {
return projectFiles; return projectFiles;
} }
set set
{ {
projectFiles = value; projectFiles = value;
@ -65,6 +66,7 @@ namespace MatterHackers.MatterControl
{ {
return projectName; return projectName;
} }
set set
{ {
projectName = value; projectName = value;
@ -77,6 +79,7 @@ namespace MatterHackers.MatterControl
{ {
return projectDateCreated; return projectDateCreated;
} }
set set
{ {
projectDateCreated = value; projectDateCreated = value;
@ -109,8 +112,8 @@ namespace MatterHackers.MatterControl
string jsonString = JsonConvert.SerializeObject(this.project, Newtonsoft.Json.Formatting.Indented); string jsonString = JsonConvert.SerializeObject(this.project, Newtonsoft.Json.Formatting.Indented);
string pathToDataFolder = Path.Combine(applicationDataPath, "data"); string pathToDataFolder = Path.Combine(applicationDataPath, "data");
if (!Directory.Exists(pathToDataFolder)) if (!Directory.Exists(pathToDataFolder))
{ {
Directory.CreateDirectory(pathToDataFolder); Directory.CreateDirectory(pathToDataFolder);
} }
@ -140,6 +143,5 @@ namespace MatterHackers.MatterControl
return newProject.ProjectFiles; return newProject.ProjectFiles;
} }
} }
} }

@ -1 +1 @@
Subproject commit 28052c646960fbf2ecb1c54fdff69f7fac307f63 Subproject commit 8fc0e4bf59d7a45e1fee86e93c30a120758c57f0

@ -1 +1 @@
Subproject commit 4a7434a815eb359fc4f679a0a351ee42507e005e Subproject commit f8006c885d7b12a0958ed644a491392d9849c6d7