private void ConditionalyCloseNow(bool continueWithShutdown) { if (continueWithShutdown) { PrinterConnectionAndCommunication.Instance.Disable(); MatterControlApplication app = MatterControlApplication.Instance; app.RestartOnClose = false; app.Close(); } }
private void RestartApplication() { UiThread.RunOnIdle((state) => { //horrible hack - to be replaced GuiWidget parent = this; while (parent as MatterControlApplication == null) { parent = parent.Parent; } MatterControlApplication app = parent as MatterControlApplication; app.RestartOnClose = true; app.Close(); }); }
bool exit_Click() { UiThread.RunOnIdle((state) => { GuiWidget parent = this; while (parent as MatterControlApplication == null) { parent = parent.Parent; } MatterControlApplication app = parent as MatterControlApplication; app.RestartOnClose = false; app.Close(); }); return(true); }
protected override IEnumerable <MenuItemAction> GetMenuActions() { return(new List <MenuItemAction> { new MenuItemAction("Add Printer".Localize(), () => WizardWindow.Show()), new MenuItemAction("Add File To Queue".Localize(), importFile_Click), new MenuItemAction("Redeem Design Code".Localize(), () => RedeemDesignCode?.Invoke(this, null)), new MenuItemAction("Enter Share Code".Localize(), () => EnterShareCode?.Invoke(this, null)), new MenuItemAction("------------------------", null), new MenuItemAction("Exit".Localize(), () => { MatterControlApplication app = this.Parents <MatterControlApplication>().FirstOrDefault(); app.RestartOnClose = false; app.Close(); }) }); }
private void ConditionalyCloseNow(bool continueWithShutdown) { // Response received, cecord that we are not waiting anymore. closeMessageBoxIsOpen = false; if (continueWithShutdown) { closeHasBeenConfirmed = true; bool printingFromSdCard = PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd || (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Paused && PrinterConnectionAndCommunication.Instance.PrePauseCommunicationState == PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd); if (!printingFromSdCard) { PrinterConnectionAndCommunication.Instance.Disable(); } MatterControlApplication app = MatterControlApplication.Instance; app.RestartOnClose = false; app.Close(); } }
protected override IEnumerable <MenuItemAction> GetMenuActions() { return(new List <MenuItemAction> { // TODO: Helper while building printing window prototype... remove once finalized new MenuItemAction("Printing Window...".Localize(), () => PrintingWindow.Show()), new MenuItemAction("------------------------", null), new MenuItemAction("Add Printer".Localize(), AddPrinter_Click), new MenuItemAction("Import Printer".Localize(), ImportPrinter), new MenuItemAction("Add File To Queue".Localize(), importFile_Click), new MenuItemAction("Redeem Design Code".Localize(), () => ApplicationController.Instance.RedeemDesignCode?.Invoke()), new MenuItemAction("Enter Share Code".Localize(), () => ApplicationController.Instance.EnterShareCode?.Invoke()), new MenuItemAction("------------------------", null), new MenuItemAction("Exit".Localize(), () => { MatterControlApplication app = this.Parents <MatterControlApplication>().FirstOrDefault(); app.RestartOnClose = false; app.Close(); }) }); }
private bool exit_Click() { UiThread.RunOnIdle(() => { GuiWidget parent = this; while (parent as MatterControlApplication == null) { parent = parent.Parent; } if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) { StyledMessageBox.ShowMessageBox(null, cannotExitWhileActiveMessage, cannotExitWhileActiveTitle); } else { MatterControlApplication app = parent as MatterControlApplication; app.RestartOnClose = false; app.Close(); } }); return(true); }