Prevent user from adding a printer from file menu while print is active.

Previous pull request prevents user from adding a printer via printers... dropdown while print is active
or paused . This commit achieves the same goal when users take the same action in the file menu.
This commit is contained in:
Greg 2016-08-22 15:03:31 -07:00
parent 13f8660214
commit eb93687bd5

View file

@ -35,7 +35,7 @@ namespace MatterHackers.MatterControl
{
return new List<MenuItemAction>
{
new MenuItemAction("Add Printer".Localize(), () => WizardWindow.ShowPrinterSetup(true)),
new MenuItemAction("Add Printer".Localize(), AddPrinter_Click),
new MenuItemAction("Import Printer".Localize(), ImportPrinter),
new MenuItemAction("Add File To Queue".Localize(), importFile_Click),
new MenuItemAction("Redeem Design Code".Localize(), () => RedeemDesignCode?.Invoke(this, null)),
@ -71,6 +71,21 @@ namespace MatterHackers.MatterControl
}
}
private void AddPrinter_Click()
{
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
{
UiThread.RunOnIdle(() =>
StyledMessageBox.ShowMessageBox(null, "Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize())
);
}
else
{
WizardWindow.ShowPrinterSetup(true);
}
}
private void importFile_Click()
{
FileDialog.OpenFileDialog(