Starting work on post print notifications

This commit is contained in:
LarsBrubaker 2019-04-12 07:54:27 -07:00
parent 20d883eb68
commit cbd2ef77db
2 changed files with 43 additions and 6 deletions

View file

@ -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<bool> 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)

@ -1 +1 @@
Subproject commit 86fbe3c7fc1ea12611cd66409806abf8f5bc10da
Subproject commit 62e0c361791b279ddaca49fec2d45accab03f5ab