public override bool Disconnect(bool force) { if (!connected) { return(true); } // Test if we should warn about heaters still on. if (writeThread != null) { writeThread.Abort(); writeThread = null; } connected = false; virtualPrinter.close(); job.KillJob(); history.Clear(); injectCommands.Clear(); try { con.FireConnectionChange(Trans.T("L_DISCONNECTED")); } catch { } // Closing the app can cause an exception, if event comes after Main handle is destroyed con.firePrinterAction(Trans.T("L_IDLE")); Main.main.Invoke(Main.main.UpdateJobButtons); return(true); }