コード例 #1
0
        public SyncingPrintersPage()
            : base("Close")
        {
            TextWidget syncingText = new TextWidget("Syncing Profiles...".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);

            syncingDetails = new TextWidget("Retrieving sync information...".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor, pointSize: 10);
            syncingDetails.AutoExpandBoundsToText = true;
            contentRow.AddChild(syncingText);
            contentRow.AddChild(syncingDetails);
            Progress <SyncReportType> progress = new Progress <SyncReportType>(ReportProgress);

            ApplicationController.SyncPrinterProfiles("SyncingPrintersPage.ctor()", progress).ContinueWith((task) =>
            {
                if (!ProfileManager.Instance.ActiveProfiles.Any())
                {
                    // Switch to setup wizard if no profiles exist
                    WizardWindow.ChangeToSetupPrinterForm();
                }
                else if (ProfileManager.Instance.ActiveProfiles.Count() == 1)
                {
                    //Set as active printer
                    ActiveSliceSettings.SwitchToProfile(ProfileManager.Instance.ActiveProfiles.First().ID);
                    // only close the window if we are not switching to the setup printer form
                    UiThread.RunOnIdle(WizardWindow.Close);
                }
                else                 // multiple printers - close the window
                {
                    UiThread.RunOnIdle(WizardWindow.Close);
                }
            });
            footerRow.AddChild(new HorizontalSpacer());
            footerRow.AddChild(cancelButton);
        }