Use AnyPrintTaskRunning helper

This commit is contained in:
John Lewin 2018-11-11 13:45:48 -08:00
parent 4f683d490a
commit 90a219e89b
3 changed files with 3 additions and 5 deletions

View file

@ -171,7 +171,7 @@ namespace MatterHackers.MatterControl
RenderOrthographic ? RenderType.ORTHOGROPHIC : RenderType.RAY_TRACE,
width,
height,
allowMultiThreading: !ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPrinting);
allowMultiThreading: !ApplicationController.Instance.AnyPrintTaskRunning);
}
public ImageBuffer DefaultImage { get; } = AggContext.StaticData.LoadIcon("mesh.png");

View file

@ -260,8 +260,7 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
else
{
// TODO: when this opens a new tab we will not need to check any printer
if (activePrinter.Connection.PrinterIsPrinting
|| activePrinter.Connection.PrinterIsPaused)
if (ApplicationController.Instance.AnyPrintTaskRunning)
{
// TODO: Rather than block here, the UI elements driving the change should be disabled while printing/paused
UiThread.RunOnIdle(() =>

View file

@ -86,8 +86,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
createPrinter.Click += (s, e) => UiThread.RunOnIdle(() =>
{
if (ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPrinting
|| ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPaused)
if (ApplicationController.Instance.AnyPrintTaskRunning)
{
StyledMessageBox.ShowMessageBox("Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize());
}