Extract ClosePopup behavior for reuse, invoke on Warnings dismiss

This commit is contained in:
jlewin 2019-05-31 17:57:52 -07:00
parent 9bdd60d483
commit aae2976c95

View file

@ -101,12 +101,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
// Invoke FixAction
action.Action.Invoke();
// Close popup on FixAction button click
if (this.Parents<PopupWidget>().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<PopupWidget>().FirstOrDefault() is PopupWidget popupWidget)
{
UiThread.RunOnIdle(popupWidget.CloseMenu);
}
}
}
}