public void OnLoadActions() { Load?.Invoke(this, null); // Pushing this after load fixes that empty printer list ApplicationController.Instance.UserChanged(); if (!System.IO.File.Exists(@"/storage/sdcard0/Download/LaunchTestPrint.stl")) { bool showAuthWindow = WizardWindow.ShouldShowAuthPanel?.Invoke() ?? false; if (showAuthWindow) { if (ApplicationSettings.Instance.get(ApplicationSettingsKey.SuppressAuthPanel) != "True") { //Launch window to prompt user to sign in UiThread.RunOnIdle(() => WizardWindow.ShowPrinterSetup()); } } else { //If user in logged in sync before checking to prompt to create printer if (ApplicationController.SyncPrinterProfiles == null) { RunSetupIfRequired(); } else { ApplicationController.SyncPrinterProfiles.Invoke("ApplicationController.OnLoadActions()", null).ContinueWith((task) => { RunSetupIfRequired(); }); } } if (OsInformation.OperatingSystem == OSType.Android) { // show this last so it is on top if (UserSettings.Instance.get("SoftwareLicenseAccepted") != "true") { UiThread.RunOnIdle(() => WizardWindow.Show <LicenseAgreementPage>("SoftwareLicense", "Software License Agreement")); } } } else { StartPrintingTest(); } if (ActiveSliceSettings.Instance.PrinterSelected && ActiveSliceSettings.Instance.GetValue <bool>(SettingsKey.auto_connect)) { UiThread.RunOnIdle(() => { //PrinterConnectionAndCommunication.Instance.HaltConnectionThread(); PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(); }, 2); } }
private static void RunSetupIfRequired() { ApplicationController.Instance.ReloadAdvancedControlsPanel(); if (!ProfileManager.Instance.ActiveProfiles.Any()) { // Start the setup wizard if no profiles exist UiThread.RunOnIdle(() => WizardWindow.ShowPrinterSetup()); } }
private void AddPrinter_Click() { if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused) { UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(null, "Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize()) ); } else { WizardWindow.ShowPrinterSetup(true); } }