public PrinterSelector() : base("Printers".Localize() + "... ", useLeftIcons: true)
        {
            Rebuild();

            this.AddItem(
                StaticData.Instance.LoadIcon("icon_plus.png", 32, 32),
                "Add New Printer...",
                "new");

            this.SelectionChanged += (s, e) =>
            {
                string printerID = this.SelectedValue;
                if (printerID == "new")
                {
                    if (AddPrinter != null)
                    {
                        UiThread.RunOnIdle(() => AddPrinter(this, null));
                    }
                }
                else
                {
                    ActiveSliceSettings.SwitchToProfile(printerID);
                }
            };

            SliceSettingsWidget.SettingChanged.RegisterEvent(SettingChanged, ref unregisterEvents);
        }
        public PrinterSelector() : base("Printers".Localize() + "... ", useLeftIcons: true)
        {
            //Add the menu items to the menu itself
            foreach (var printer in ActiveSliceSettings.ProfileData.Profiles)
            {
                this.AddItem(printer.Name, printer.Id.ToString());
            }

            if (ActiveSliceSettings.Instance != null)
            {
                this.SelectedValue = ActiveSliceSettings.Instance.ID;
            }

            ImageBuffer plusImage = StaticData.Instance.LoadIcon("icon_plus.png", 32, 32);

            this.AddItem(plusImage, "Add New Printer...", "new");

            this.SelectionChanged += (s, e) =>
            {
                string printerID = this.SelectedValue;
                if (printerID == "new")
                {
                    if (AddPrinter != null)
                    {
                        UiThread.RunOnIdle(() => AddPrinter(this, null));
                    }
                }
                else
                {
                    ActiveSliceSettings.SwitchToProfile(printerID);
                }
            };
        }
        private void ImportSettingsFile(string settingsFilePath)
        {
            WizardWindow.Close();

            switch (importMode)
            {
            case "new":
                ActiveSliceSettings.ImportFromExisting(settingsFilePath);
                break;

            case "merge":
            case "replace":
                ReplaceOrMergeSettings(settingsFilePath);
                break;
            }
        }
        public PrinterSelector() : base("Printers".Localize() + "... ", useLeftIcons: true)
        {
            Rebuild();

            this.SelectionChanged += (s, e) =>
            {
                string printerID = this.SelectedValue;
                if (printerID == "new")
                {
                    // do nothing
                }
                else
                {
                    ActiveSliceSettings.SwitchToProfile(printerID);
                }
            };

            SliceSettingsWidget.SettingChanged.RegisterEvent(SettingChanged, ref unregisterEvents);
            ProfileManager.ProfilesListChanged.RegisterEvent(SettingChanged, ref unregisterEvents);
        }
        public PrinterSelector() : base("Printers".Localize() + "... ")
        {
            Rebuild();

            this.Name = "Printers... Menu";

            this.SelectionChanged += (s, e) =>
            {
                string printerID = this.SelectedValue;
                if (printerID == "new" ||
                    string.IsNullOrEmpty(printerID) ||
                    printerID == ActiveSliceSettings.Instance.ID)
                {
                    // do nothing
                }
                else
                {
                    if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting ||
                        PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
                    {
                        if (this.SelectedIndex != lastSelectedIndex)
                        {
                            UiThread.RunOnIdle(() =>
                                               StyledMessageBox.ShowMessageBox(null, "Please wait until the print has finished and try again.".Localize(), "Can't switch printers while printing".Localize())
                                               );
                            this.SelectedIndex = lastSelectedIndex;
                        }
                    }
                    else
                    {
                        lastSelectedIndex = this.SelectedIndex;
                        UiThread.RunOnIdle(() => ActiveSliceSettings.SwitchToProfile(printerID));
                    }
                }
            };

            ActiveSliceSettings.SettingChanged.RegisterEvent(SettingChanged, ref unregisterEvents);

            // Rebuild the droplist any time the Profiles list changes
            ProfileManager.ProfilesListChanged.RegisterEvent((s, e) => Rebuild(), ref unregisterEvents);
        }