From caa79ddff026a8a05abdf5c888453a32b3440ee8 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 28 Sep 2016 16:29:11 -0700 Subject: [PATCH] Don't load deleted printers --- ActionBar/PrintActionRow.cs | 3 ++- SlicerConfiguration/Settings/ProfileManager.cs | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs index 958aeacfd..7f32de178 100644 --- a/ActionBar/PrintActionRow.cs +++ b/ActionBar/PrintActionRow.cs @@ -322,7 +322,7 @@ namespace MatterHackers.MatterControl.ActionBar if (!PrinterConnectionAndCommunication.Instance.PrinterIsConnected && PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect) { - if (ProfileManager.Instance.Profiles.Count() == 0) + if (!ProfileManager.Instance.ActiveProfiles.Any()) { this.activePrintButtons.Add(addPrinterButton); } @@ -338,6 +338,7 @@ namespace MatterHackers.MatterControl.ActionBar this.activePrintButtons.Add(selectPrinterButton); } } + ShowActiveButtons(); EnableActiveButtons(); } diff --git a/SlicerConfiguration/Settings/ProfileManager.cs b/SlicerConfiguration/Settings/ProfileManager.cs index 9fe168768..23e22864e 100644 --- a/SlicerConfiguration/Settings/ProfileManager.cs +++ b/SlicerConfiguration/Settings/ProfileManager.cs @@ -247,8 +247,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration public static PrinterSettings LoadWithoutRecovery(string profileID) { - string profilePath = Instance[profileID]?.ProfilePath; - if (profilePath != null && File.Exists(profilePath)) + var printerInfo = Instance[profileID]; + + string profilePath = printerInfo?.ProfilePath; + if (profilePath != null + && File.Exists(profilePath) + && !printerInfo.MarkedForDelete) { try {