Getting messages for print finished and print canceled so we can display messages
This commit is contained in:
parent
21613b5cd2
commit
dcedd2034e
3 changed files with 26 additions and 13 deletions
|
|
@ -2907,6 +2907,22 @@ namespace MatterHackers.MatterControl
|
|||
UiThread.RunOnIdle(() => this.ShellFileOpened?.Invoke(this, file));
|
||||
}
|
||||
|
||||
public void Connection_PrintFinished(object sender, string e)
|
||||
{
|
||||
// TODO: show a long running task asking about print feedback and up-selling more materials
|
||||
// Ask about the print, offer help if needed.
|
||||
// Let us know how your print came out.
|
||||
}
|
||||
|
||||
public void Connection_PrintCanceled(object sender, EventArgs e)
|
||||
{
|
||||
// TODO: show a long running task showing support options
|
||||
// add links to forum, articles and documentation
|
||||
// support: "https://www.matterhackers.com/support#mattercontrol"
|
||||
// documentation: "https://www.matterhackers.com/mattercontrol/support"
|
||||
// forum: "https://forums.matterhackers.com/recent"
|
||||
}
|
||||
|
||||
public class CloudSyncEventArgs : EventArgs
|
||||
{
|
||||
public bool IsAuthenticated { get; set; }
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
// Register listeners
|
||||
this.Connection.TemporarilyHoldingTemp += ApplicationController.Instance.Connection_TemporarilyHoldingTemp;
|
||||
this.Connection.PrintFinished += ApplicationController.Instance.Connection_PrintFinished;
|
||||
this.Connection.PrintCanceled += ApplicationController.Instance.Connection_PrintCanceled;
|
||||
this.Connection.ErrorReported += ApplicationController.Instance.Connection_ErrorReported;
|
||||
this.Connection.ConnectionSucceeded += Connection_ConnectionSucceeded;
|
||||
this.Connection.CommunicationStateChanged += Connection_CommunicationStateChanged;
|
||||
|
|
@ -247,7 +249,7 @@ namespace MatterHackers.MatterControl
|
|||
this.Bed.BedShape = this.Settings.GetValue<BedShape>(SettingsKey.bed_shape);
|
||||
}
|
||||
|
||||
private void Connection_PrintFinished(object s, EventArgs e)
|
||||
private void Connection_PrintFinished(object s, string printName)
|
||||
{
|
||||
// clear single use setting on print completion
|
||||
foreach (var keyValue in this.Settings.BaseLayer)
|
||||
|
|
@ -424,6 +426,8 @@ namespace MatterHackers.MatterControl
|
|||
this.Connection.ConnectionSucceeded -= Connection_ConnectionSucceeded;
|
||||
this.Connection.PrintFinished -= Connection_PrintFinished;
|
||||
this.Connection.TemporarilyHoldingTemp -= ApplicationController.Instance.Connection_TemporarilyHoldingTemp;
|
||||
this.Connection.PrintFinished -= ApplicationController.Instance.Connection_PrintFinished;
|
||||
this.Connection.PrintCanceled -= ApplicationController.Instance.Connection_PrintCanceled;
|
||||
this.Connection.ErrorReported -= ApplicationController.Instance.Connection_ErrorReported;
|
||||
|
||||
macroReplacements = null;
|
||||
|
|
|
|||
|
|
@ -133,7 +133,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
FilamentRunout?.Invoke(this, printPauseEventArgs);
|
||||
}
|
||||
|
||||
public event EventHandler<PrintFinishedEventArgs> PrintFinished;
|
||||
public event EventHandler<string> PrintFinished;
|
||||
public event EventHandler PrintCanceled;
|
||||
|
||||
public event EventHandler<PrintPauseEventArgs> PauseOnLayer;
|
||||
|
||||
|
|
@ -579,7 +580,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
timePrinting.Stop();
|
||||
if (Printer.Bed?.EditContext?.SourceItem.Name != null)
|
||||
{
|
||||
PrintFinished?.Invoke(this, new PrintFinishedEventArgs(Printer.Bed.EditContext.SourceItem.Name));
|
||||
PrintFinished?.Invoke(this, Printer.Bed.EditContext.SourceItem.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -2532,6 +2533,8 @@ You will then need to logout and log back in to the computer for the changes to
|
|||
ReleaseMotors();
|
||||
TurnOffBedAndExtruders(TurnOff.AfterDelay);
|
||||
this.PrintWasCanceled = false;
|
||||
// and finally notify anyone that wants to know
|
||||
PrintCanceled?.Invoke(this, null);
|
||||
}
|
||||
else if (communicationState == CommunicationStates.Printing)// we finished printing normally
|
||||
{
|
||||
|
|
@ -2959,16 +2962,6 @@ You will then need to logout and log back in to the computer for the changes to
|
|||
UsbDisconnected
|
||||
}
|
||||
|
||||
public class PrintFinishedEventArgs : EventArgs
|
||||
{
|
||||
public PrintFinishedEventArgs(string name)
|
||||
{
|
||||
this.ItemName = name;
|
||||
}
|
||||
|
||||
public string ItemName { get; }
|
||||
}
|
||||
|
||||
public class PrintPauseEventArgs : EventArgs
|
||||
{
|
||||
public PrintPauseEventArgs(string name, bool filamentRunout, int layerNumber)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue