diff --git a/PrinterControls/ControlWidgets/MacroControls.cs b/PrinterControls/ControlWidgets/MacroControls.cs index 854052980..5630d0a36 100644 --- a/PrinterControls/ControlWidgets/MacroControls.cs +++ b/PrinterControls/ControlWidgets/MacroControls.cs @@ -162,7 +162,7 @@ namespace MatterHackers.MatterControl.PrinterControls return macroButtonContainer; } - private IEnumerable GetMacros() + internal static IEnumerable GetMacros() { if (ActivePrinterProfile.Instance.ActivePrinter != null) { diff --git a/PrinterControls/EditMacrosWindow.cs b/PrinterControls/EditMacrosWindow.cs index bc4fdf5cb..40f9fb5b4 100644 --- a/PrinterControls/EditMacrosWindow.cs +++ b/PrinterControls/EditMacrosWindow.cs @@ -32,6 +32,7 @@ using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.FieldValidation; +using MatterHackers.MatterControl.PrinterControls; using MatterHackers.VectorMath; using System; using System.Collections.Generic; @@ -286,8 +287,7 @@ namespace MatterHackers.MatterControl topToBottom.AddChild(presetsFormContainer); - IEnumerable macroList = GetMacros(); - foreach (DataStorage.CustomCommands currentCommand in macroList) + foreach (DataStorage.CustomCommands currentCommand in MacroControlsWidget.GetMacros()) { FlowLayoutWidget macroRow = new FlowLayoutWidget(); macroRow.Margin = new BorderDouble(3, 0, 3, 3); @@ -354,19 +354,6 @@ namespace MatterHackers.MatterControl this.AnchorAll(); } - private IEnumerable GetMacros() - { - IEnumerable results = Enumerable.Empty(); - if (ActivePrinterProfile.Instance.ActivePrinter != null) - { - //Retrieve a list of saved printers from the Datastore - string query = string.Format("SELECT * FROM CustomCommands WHERE PrinterId = {0};", ActivePrinterProfile.Instance.ActivePrinter.Id); - results = (IEnumerable)DataStorage.Datastore.Instance.dbSQLite.Query(query); - return results; - } - return results; - } - private void addMacro_Click(object sender, EventArgs mouseEvent) { windowController.ChangeToMacroDetail();