From 2e631c5a49efe9738b5f9aba2acdbf8790faf332 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 13 Feb 2018 16:41:09 -0800 Subject: [PATCH] Remove slicing members from PrintItemWrapper - Issue MatterHackers/MCCentral#2825 --- Queue/OptionsMenu/ExportToFolderProcess.cs | 13 ++--- Queue/PrintItemWrapper.cs | 57 ---------------------- 2 files changed, 3 insertions(+), 67 deletions(-) diff --git a/Queue/OptionsMenu/ExportToFolderProcess.cs b/Queue/OptionsMenu/ExportToFolderProcess.cs index e41a60da0..450cfc973 100644 --- a/Queue/OptionsMenu/ExportToFolderProcess.cs +++ b/Queue/OptionsMenu/ExportToFolderProcess.cs @@ -114,18 +114,14 @@ namespace MatterHackers.MatterControl.PrintQueue } else if (Path.GetExtension(printItemWrapper.FileLocation).ToUpper() == ".GCODE") { - sliceItem_Done(printItemWrapper, null); + this.SlicingCompleted(printItemWrapper); } } } } - private void sliceItem_Done(object sender, EventArgs e) + private void SlicingCompleted(PrintItemWrapper sliceItem) { - PrintItemWrapper sliceItem = (PrintItemWrapper)sender; - - sliceItem.SlicingDone -= sliceItem_Done; - if (File.Exists(sliceItem.FileLocation)) { savedGCodeFileNames.Add(sliceItem.GetGCodePathAndFileName()); @@ -224,10 +220,7 @@ namespace MatterHackers.MatterControl.PrintQueue } } - if (DoneSaving != null) - { - DoneSaving(this, new StringEventArgs(string.Format("{0:0.0}", total))); - } + DoneSaving?.Invoke(this, new StringEventArgs(string.Format("{0:0.0}", total))); } } } diff --git a/Queue/PrintItemWrapper.cs b/Queue/PrintItemWrapper.cs index cf38b7f94..78500f591 100644 --- a/Queue/PrintItemWrapper.cs +++ b/Queue/PrintItemWrapper.cs @@ -67,14 +67,6 @@ namespace MatterHackers.MatterControl.PrintQueue public class PrintItemWrapper { - public event EventHandler SlicingDone; - - private string fileNotFound = "File Not Found\n'{0}'".Localize(); - private string readyToPrint = "Ready to Print".Localize(); - private string slicingError = "Slicing Error".Localize(); - - private bool doneSlicing; - private string fileType; public PrintItemWrapper(PrintItem printItem, ILibraryContainer sourceLibraryProviderLocator = null) @@ -104,51 +96,6 @@ namespace MatterHackers.MatterControl.PrintQueue } } - public bool CurrentlySlicing { get; set; } - - public bool DoneSlicing - { - get - { - return doneSlicing; - } - - set - { - if (value != doneSlicing) - { - doneSlicing = value; - if (doneSlicing) - { - string message = slicingError; - this.SlicingHadError = true; - if (File.Exists(FileLocation)) - { - string gcodePathAndFileName = GetGCodePathAndFileName(); - if (gcodePathAndFileName != "" && File.Exists(gcodePathAndFileName)) - { - FileInfo info = new FileInfo(gcodePathAndFileName); - // This is really just to make sure it is bigger than nothing. - if (info.Length > 10) - { - message = readyToPrint; - this.SlicingHadError = false; - } - } - } - else - { - message = string.Format(fileNotFound, FileLocation); - } - - OnSlicingOutputMessage(new StringEventArgs(message)); - - SlicingDone?.Invoke(this, null); - } - } - } - } - public string FileHashCode { get @@ -216,9 +163,5 @@ namespace MatterHackers.MatterControl.PrintQueue ApplicationDataStorage.Instance.GCodeOutputPath, $"{fileHashCode}_{ settingsHashCode}.gcode"); } - - public void OnSlicingOutputMessage(EventArgs e) - { - } } } \ No newline at end of file