diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index 0d91736ea..6d387d332 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -2750,11 +2750,48 @@ namespace MatterHackers.MatterControl 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" + if (sender is PrinterConnection printerConnection) + { + // 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" + + string markdownText = "A sample notification message"; + + ShowNotification(markdownText, () => + { + return true; + }); + } + } + + private void ShowNotification(string markdownText, Func keepShowing) + { + if (!string.IsNullOrEmpty(markdownText)) + { + bool stopped = false; + Tasks.Execute("Notification", null, (reporter, cancellationToken) => + { + var progressStatus = new ProgressStatus(); + + while (keepShowing() && !stopped) + { + Thread.Sleep(200); + } + + return Task.CompletedTask; + }, + taskActions: new RunningTaskOptions() + { + StopAction = (abortCancel) => UiThread.RunOnIdle(() => + { + stopped = true; + }), + StopToolTip = "Dismiss".Localize() + }); + } } public void ConnectToPrinter(PrinterConfig printer) diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 86fbe3c7f..62e0c3617 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 86fbe3c7fc1ea12611cd66409806abf8f5bc10da +Subproject commit 62e0c361791b279ddaca49fec2d45accab03f5ab