From 079afa7cd7caa9406fc9c79b5ce2d2ddc18fab66 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Fri, 24 Jun 2016 11:58:29 -0700 Subject: [PATCH] Initial delete profile implementation --- SlicerConfiguration/Settings/ProfileManager.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SlicerConfiguration/Settings/ProfileManager.cs b/SlicerConfiguration/Settings/ProfileManager.cs index a306450d1..1a0ecb541 100644 --- a/SlicerConfiguration/Settings/ProfileManager.cs +++ b/SlicerConfiguration/Settings/ProfileManager.cs @@ -53,9 +53,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration private static EventHandler unregisterEvents; + // Should be executed after deleting the profile from MCWS and should probably be moved to CloudLibrary public void PermanentDelete(string printerToken) { - /*Remove Printer Entity from list of profiles, delete profile on disk and save the Manager.Save()*/ + // Find and delete the PrinterInfo from the Profiles list + var printerInfo = Profiles.Where(p => p.ID == printerToken).FirstOrDefault(); + Profiles.Remove(printerInfo); + + // Delete the + File.Delete(printerInfo.ProfilePath); + + Instance.Save(); } public static RootedObjectEventHandler ProfilesListChanged = new RootedObjectEventHandler();