diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index beb70d209..7b5ef8156 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -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; } diff --git a/MatterControlLib/ApplicationView/PrinterConfig.cs b/MatterControlLib/ApplicationView/PrinterConfig.cs index fd4cd344f..0660480b5 100644 --- a/MatterControlLib/ApplicationView/PrinterConfig.cs +++ b/MatterControlLib/ApplicationView/PrinterConfig.cs @@ -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(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; diff --git a/MatterControlLib/PrinterCommunication/PrinterConnection.cs b/MatterControlLib/PrinterCommunication/PrinterConnection.cs index 5e6fe1636..87e44dcb7 100644 --- a/MatterControlLib/PrinterCommunication/PrinterConnection.cs +++ b/MatterControlLib/PrinterCommunication/PrinterConnection.cs @@ -133,7 +133,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication FilamentRunout?.Invoke(this, printPauseEventArgs); } - public event EventHandler PrintFinished; + public event EventHandler PrintFinished; + public event EventHandler PrintCanceled; public event EventHandler 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)