From 2acbffd0edcebc4cc4ee37c931e4a4d551b37312 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 16 Nov 2017 16:31:06 -0800 Subject: [PATCH 1/4] Print menu should be disabled unless CommunicationState == Connected - Issue MatterHackers/MCCentral#2271 Print library action is invalid if not in Connected state --- Library/Widgets/PrintLibraryWidget.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index 61e005079..407a4caed 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -407,7 +407,8 @@ namespace MatterHackers.MatterControl.PrintLibrary // Singleselect - disallow containers return listView.SelectedItems.Count == 1 && selectedListItems.FirstOrDefault()?.Model is ILibraryItem firstItem - && !(firstItem is ILibraryContainer); + && !(firstItem is ILibraryContainer) + && ApplicationController.Instance.DragDropData?.Printer.Connection.CommunicationState == CommunicationStates.Connected; } }); From 29e06c921415cc08c43def21ca5137aa980d2653 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 16 Nov 2017 16:34:27 -0800 Subject: [PATCH 2/4] Revise BedMeshGenerator use --- ApplicationView/PrinterModels.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ApplicationView/PrinterModels.cs b/ApplicationView/PrinterModels.cs index 81724b061..f9b2801d1 100644 --- a/ApplicationView/PrinterModels.cs +++ b/ApplicationView/PrinterModels.cs @@ -193,8 +193,6 @@ namespace MatterHackers.MatterControl public GCodeRenderInfo RenderInfo { get; set; } - BedMeshGenerator bedGenerator; - private Mesh _bedMesh; public Mesh Mesh { @@ -202,12 +200,10 @@ namespace MatterHackers.MatterControl { if (_bedMesh == null) { - bedGenerator = new BedMeshGenerator(); - //Construct the thing - var bedAndVolume = bedGenerator.CreatePrintBedAndVolume(Printer); - _bedMesh = bedAndVolume.bed; - _buildVolumeMesh = bedAndVolume.volume; + // Load bed and build volume meshes + var bedGenerator = new BedMeshGenerator(); + (_bedMesh, _buildVolumeMesh) = bedGenerator.CreatePrintBedAndVolume(Printer); Task.Run(() => { From df2ff919f6a12dcce00116471af9c1f6a003ba0a Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 16 Nov 2017 19:08:06 -0800 Subject: [PATCH 3/4] Use fully qualified type name --- Library/Widgets/PrintLibraryWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index 407a4caed..14be3ad3c 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -408,7 +408,7 @@ namespace MatterHackers.MatterControl.PrintLibrary return listView.SelectedItems.Count == 1 && selectedListItems.FirstOrDefault()?.Model is ILibraryItem firstItem && !(firstItem is ILibraryContainer) - && ApplicationController.Instance.DragDropData?.Printer.Connection.CommunicationState == CommunicationStates.Connected; + && ApplicationController.Instance.DragDropData?.Printer.Connection.CommunicationState == PrinterCommunication.CommunicationStates.Connected; } }); From cf7d80225e3f96bb95c2f842913a05873c64d7af Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 16 Nov 2017 19:12:38 -0800 Subject: [PATCH 4/4] Revert to now working PrinterCommunication using statement --- Library/Widgets/PrintLibraryWidget.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Widgets/PrintLibraryWidget.cs b/Library/Widgets/PrintLibraryWidget.cs index 14be3ad3c..fa5a23ef9 100644 --- a/Library/Widgets/PrintLibraryWidget.cs +++ b/Library/Widgets/PrintLibraryWidget.cs @@ -39,6 +39,7 @@ using MatterHackers.Localizations; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.Library; using MatterHackers.MatterControl.PartPreviewWindow; +using MatterHackers.MatterControl.PrinterCommunication; using MatterHackers.MatterControl.PrintQueue; namespace MatterHackers.MatterControl.PrintLibrary @@ -408,7 +409,7 @@ namespace MatterHackers.MatterControl.PrintLibrary return listView.SelectedItems.Count == 1 && selectedListItems.FirstOrDefault()?.Model is ILibraryItem firstItem && !(firstItem is ILibraryContainer) - && ApplicationController.Instance.DragDropData?.Printer.Connection.CommunicationState == PrinterCommunication.CommunicationStates.Connected; + && ApplicationController.Instance.DragDropData?.Printer.Connection.CommunicationState == CommunicationStates.Connected; } });