Make sure we always show the printing window
This commit is contained in:
parent
5896d1f345
commit
7d1e4969ad
3 changed files with 52 additions and 46 deletions
|
|
@ -1438,51 +1438,7 @@ namespace MatterHackers.MatterControl
|
|||
this.ArchiveAndStartPrint(partFilePath, gcodeFilePath);
|
||||
}
|
||||
|
||||
await ApplicationController.Instance.Tasks.Execute("Printing".Localize(),
|
||||
(reporterB, cancellationTokenB) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
reporterB.Report(progressStatus);
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
string printing = "Printing".Localize();
|
||||
int totalLayers = printer.Connection.TotalLayersInPrint;
|
||||
|
||||
while (!printer.Connection.PrinterIsPrinting
|
||||
&& !cancellationTokenB.IsCancellationRequested)
|
||||
{
|
||||
// Wait for printing
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
while ((printer.Connection.PrinterIsPrinting || printer.Connection.PrinterIsPaused)
|
||||
&& !cancellationTokenB.IsCancellationRequested)
|
||||
{
|
||||
//progressStatus.Status = $"{printing} Layer ({printer.Connection.CurrentlyPrintingLayer } of {totalLayers})";
|
||||
progressStatus.Status = $"{printing} ({printer.Connection.CurrentlyPrintingLayer + 1})";
|
||||
progressStatus.Progress0To1 = printer.Connection.PercentComplete / 100;
|
||||
reporterB.Report(progressStatus);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
});
|
||||
},
|
||||
taskActions: new RunningTaskActions()
|
||||
{
|
||||
RichProgressWidget = () => PrinterTabPage.PrintProgressWidget(printer),
|
||||
Pause = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.RequestPause();
|
||||
}),
|
||||
Resume = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.Resume();
|
||||
}),
|
||||
Stop = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
ApplicationController.Instance.ConditionalCancelPrint();
|
||||
})
|
||||
});
|
||||
await MonitorPrintTask(printer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1492,6 +1448,55 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public async Task MonitorPrintTask(PrinterConfig printer)
|
||||
{
|
||||
await ApplicationController.Instance.Tasks.Execute("Printing".Localize(),
|
||||
(reporterB, cancellationTokenB) =>
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
reporterB.Report(progressStatus);
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
string printing = "Printing".Localize();
|
||||
int totalLayers = printer.Connection.TotalLayersInPrint;
|
||||
|
||||
while (!printer.Connection.PrinterIsPrinting
|
||||
&& !cancellationTokenB.IsCancellationRequested)
|
||||
{
|
||||
// Wait for printing
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
while ((printer.Connection.PrinterIsPrinting || printer.Connection.PrinterIsPaused)
|
||||
&& !cancellationTokenB.IsCancellationRequested)
|
||||
{
|
||||
//progressStatus.Status = $"{printing} Layer ({printer.Connection.CurrentlyPrintingLayer } of {totalLayers})";
|
||||
progressStatus.Status = $"{printing} ({printer.Connection.CurrentlyPrintingLayer + 1})";
|
||||
progressStatus.Progress0To1 = printer.Connection.PercentComplete / 100;
|
||||
reporterB.Report(progressStatus);
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
});
|
||||
},
|
||||
taskActions: new RunningTaskActions()
|
||||
{
|
||||
RichProgressWidget = () => PrinterTabPage.PrintProgressWidget(printer),
|
||||
Pause = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.RequestPause();
|
||||
}),
|
||||
Resume = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
printer.Connection.Resume();
|
||||
}),
|
||||
Stop = () => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
ApplicationController.Instance.ConditionalCancelPrint();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Archives MCX and validates GCode results before starting a print operation
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
{
|
||||
printer.Connection.CommunicationState = CommunicationStates.PreparingToPrint;
|
||||
printer.Connection.StartPrint(lastPrint.PrintingGCodeFileName, lastPrint);
|
||||
ApplicationController.Instance.MonitorPrintTask(printer).ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 33d1a1d9db6343cac3426de85623564bdd1291b5
|
||||
Subproject commit 986830bd983ae97d4e1f880a2d4eb18357347165
|
||||
Loading…
Add table
Add a link
Reference in a new issue