From 4ce783cff728bbeb1947cd871ecec9d5abca55c3 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 7 Jun 2018 07:57:36 -0700 Subject: [PATCH] Filter empty items out of start page, part/printer bars - Issue MatterHackers/MCCentral#3534 --- PartPreviewWindow/PlusTab/ExplorerBar.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PartPreviewWindow/PlusTab/ExplorerBar.cs b/PartPreviewWindow/PlusTab/ExplorerBar.cs index ee3de62e9..051c81a24 100644 --- a/PartPreviewWindow/PlusTab/ExplorerBar.cs +++ b/PartPreviewWindow/PlusTab/ExplorerBar.cs @@ -187,10 +187,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab { toolbar.ActionArea.CloseAllChildren(); - // Select the 25 most recent files and project onto FileSystemItems - var recentFiles = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime); - - var lastProfileID = ProfileManager.Instance.LastProfileID; var lastProfile = ProfileManager.Instance[lastProfileID]; @@ -243,7 +239,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab toolbar.AddChild(emptyPlateButton); - foreach (var item in recentFiles.Take(10).Select(f => new SceneReplacementFileItem(f.FullName)).ToList()) + // Select the 25 most recent files and project onto FileSystemItems + var recentFiles = new DirectoryInfo(ApplicationDataStorage.Instance.PlatingDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime); + foreach (var item in recentFiles.Where(f => f.Length > 500).Select(f => new SceneReplacementFileItem(f.FullName)).Take(10).ToList()) { var iconButton = new IconViewItem(new ListViewItem(item, ApplicationController.Instance.Library.PlatingHistory), 70, 70, theme) { @@ -285,7 +283,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab public PartsBar(PartPreviewContent partPreviewContent, ThemeConfig theme) : base("Parts".Localize(), theme) { - var recentParts = new DirectoryInfo(ApplicationDataStorage.Instance.PartHistoryDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime); var emptyPlateButton = new ImageWidget(AggContext.StaticData.LoadIcon("new-part.png", 70, 70)) { @@ -317,7 +314,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab }; toolbar.AddChild(emptyPlateButton); - foreach (var item in recentParts.Take(10).Select(f => new SceneReplacementFileItem(f.FullName)).ToList()) + var recentParts = new DirectoryInfo(ApplicationDataStorage.Instance.PartHistoryDirectory).GetFiles("*.mcx").OrderByDescending(f => f.LastWriteTime); + + foreach (var item in recentParts.Where(f => f.Length > 500).Select(f => new SceneReplacementFileItem(f.FullName)).Take(10).ToList()) { var iconButton = new IconViewItem(new ListViewItem(item, ApplicationController.Instance.Library.PlatingHistory), 70, 70, theme) {