Make sure we check for print recovery even if we are connected

This code changed so that we are connected before the UI is available.
we still need to check if there is a recovery.

issue: MatterHackers/MCCentral#5423
Automatic connect does not say there is a recovery available when there is
This commit is contained in:
LarsBrubaker 2019-05-11 07:40:19 -07:00
parent 46197a10ca
commit 7debe57480

View file

@ -229,7 +229,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
// Register listeners
printer.Connection.ConnectionSucceeded += ConnectionSucceeded;
printer.Connection.ConnectionSucceeded += CheckForPrintRecovery;
// if we are already connected than check if there is a print recovery right now
if (printer.Connection.CommunicationState == CommunicationStates.Connected)
{
CheckForPrintRecovery(null, null);
}
}
bool buttonIsBeingClicked;
@ -265,12 +271,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public override void OnClosed(EventArgs e)
{
// Unregister listeners
printer.Connection.ConnectionSucceeded -= ConnectionSucceeded;
printer.Connection.ConnectionSucceeded -= CheckForPrintRecovery;
base.OnClosed(e);
}
private void ConnectionSucceeded(object s, EventArgs e)
private void CheckForPrintRecovery(object s, EventArgs e)
{
UiThread.RunOnIdle(() =>
{