From aae2976c95d3f346dbfb2e7ab6efd8e43d03782d Mon Sep 17 00:00:00 2001 From: jlewin Date: Fri, 31 May 2019 17:57:52 -0700 Subject: [PATCH] Extract ClosePopup behavior for reuse, invoke on Warnings dismiss --- .../View3D/PrinterBar/ValidationErrorsPanel.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/ValidationErrorsPanel.cs b/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/ValidationErrorsPanel.cs index 3e10ab2f7..08f40988a 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/ValidationErrorsPanel.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/ValidationErrorsPanel.cs @@ -101,12 +101,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { // Invoke FixAction action.Action.Invoke(); - - // Close popup on FixAction button click - if (this.Parents().FirstOrDefault() is PopupWidget popupWidget) - { - UiThread.RunOnIdle(popupWidget.CloseMenu); - } + this.ClosePopup(); }; row.AddChild(button); @@ -131,6 +126,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow dismissButton.Click += (sender, e) => { UserSettings.Instance.set($"Ignore_{validationError.ID}", "true"); + this.ClosePopup(); }; row.AddChild(dismissButton); @@ -139,5 +135,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.AddChild(row); } } + + private void ClosePopup() + { + if (this.Parents().FirstOrDefault() is PopupWidget popupWidget) + { + UiThread.RunOnIdle(popupWidget.CloseMenu); + } + } } } \ No newline at end of file