Exemplo n.º 1
0
        public SettingsForm()
        {
            InitializeComponent();
            Icon = SystemTrayMenu;

            // Initialize and replace here here, because designer always removes it
            InitializeTextBoxHotkeyAndReplacetextBoxHotkeyPlaceholder();
            void InitializeTextBoxHotkeyAndReplacetextBoxHotkeyPlaceholder()
            {
                textBoxHotkey = new HotkeyTextboxControl.HotkeyControl
                {
                    Hotkey          = Keys.None,
                    HotkeyModifiers = Keys.None,
                    Name            = "textBoxHotkey",
                    Size            = new Size(200, 20),
                    Text            = "None",
                };
                textBoxHotkey.Enter += new EventHandler(TextBoxHotkeyEnter);
                textBoxHotkey.Leave += new EventHandler(TextBoxHotkey_Leave);
                tableLayoutPanelHotkey.Controls.Remove(textBoxHotkeyPlaceholder);
                tableLayoutPanelHotkey.Controls.Add(textBoxHotkey, 0, 0);
            }

            // designer always resets it to 1
            tabControl.SelectedIndex = 0;

            CombineControls(textBoxColorTitle, pictureBoxTitle);
            CombineControls(textBoxColorBackground, pictureBoxBackground);
            CombineControls(textBoxColorSearchField, pictureBoxSearchField);
            CombineControls(textBoxColorOpenFolder, pictureBoxOpenFolder);
            CombineControls(textBoxColorOpenFolderBorder, pictureBoxOpenFolderBorder);
            CombineControls(textBoxColorSelectedItem, pictureBoxSelectedItem);
            CombineControls(textBoxColorSelectedItemBorder, pictureBoxSelectedItemBorder);
            CombineControls(textBoxColorWarning, pictureBoxWarning);
            CombineControls(textBoxColorScrollbarBackground, pictureBoxScrollbarBackground);
            CombineControls(textBoxColorSlider, pictureBoxSlider);
            CombineControls(textBoxColorSliderDragging, pictureBoxSliderDragging);
            CombineControls(textBoxColorSliderHover, pictureBoxSliderHover);
            CombineControls(textBoxColorSliderArrowsAndTrackHover, pictureBoxSliderArrowsAndTrackHover);
            CombineControls(textBoxColorArrow, pictureBoxArrow);
            CombineControls(textBoxColorArrowClick, pictureBoxArrowClick);
            CombineControls(textBoxColorArrowClickBackground, pictureBoxArrowClickBackground);
            CombineControls(textBoxColorArrowHover, pictureBoxArrowHover);
            CombineControls(textBoxColorArrowHoverBackground, pictureBoxArrowHoverBackground);

            CombineControls(textBoxColorTitleDarkMode, pictureBoxTitleDarkMode);
            CombineControls(textBoxColorBackgroundDarkMode, pictureBoxBackgroundDarkMode);
            CombineControls(textBoxColorSearchFieldDarkMode, pictureBoxSearchFieldDarkMode);
            CombineControls(textBoxColorOpenFolderDarkMode, pictureBoxOpenFolderDarkMode);
            CombineControls(textBoxColorOpenFolderBorderDarkMode, pictureBoxOpenFolderBorderDarkMode);
            CombineControls(textBoxColorSelecetedItemDarkMode, pictureColorBoxSelectedItemDarkMode);
            CombineControls(textBoxColorSelectedItemBorderDarkMode, pictureBoxSelectedItemBorderDarkMode);
            CombineControls(textBoxColorWarningDarkMode, pictureBoxWarningDarkMode);
            CombineControls(textBoxColorScrollbarBackgroundDarkMode, pictureBoxScrollbarBackgroundDarkMode);
            CombineControls(textBoxColorSliderDarkMode, pictureBoxSliderDarkMode);
            CombineControls(textBoxColorSliderDraggingDarkMode, pictureBoxSliderDraggingDarkMode);
            CombineControls(textBoxColorSliderHoverDarkMode, pictureBoxSliderHoverDarkMode);
            CombineControls(textBoxColorSliderArrowsAndTrackHoverDarkMode, pictureBoxSliderArrowsAndTrackHoverDarkMode);
            CombineControls(textBoxColorArrowDarkMode, pictureBoxArrowDarkMode);
            CombineControls(textBoxColorArrowClickDarkMode, pictureBoxArrowClickDarkMode);
            CombineControls(textBoxColorArrowClickBackgroundDarkMode, pictureBoxArrowClickBackgroundDarkMode);
            CombineControls(textBoxColorArrowHoverDarkMode, pictureBoxArrowHoverDarkMode);
            CombineControls(textBoxColorArrowHoverBackgroundDarkMode, pictureBoxArrowHoverBackgroundDarkMode);
            void CombineControls(Control textBoxColor, Control pictureBox)
            {
                textBoxColor.Tag = pictureBox;
                pictureBox.Tag   = textBoxColor;
            }

            Translate();
            void Translate()
            {
                Text = Translator.GetText("Settings");
                tabPageGeneral.Text                = Translator.GetText("General");
                tabPageAdvanced.Text               = Translator.GetText("Advanced");
                tabPageCustomize.Text              = Translator.GetText("Customize");
                groupBoxFolder.Text                = Translator.GetText("Folder");
                buttonChangeFolder.Text            = Translator.GetText("Change folder");
                checkBoxUseIconFromRootFolder.Text = Translator.GetText("Use icon from folder");
                groupBoxUSB.Text = Translator.GetText("USB");
                buttonChangeRelativeFolder.Text            = Translator.GetText("Change to relative folder");
                checkBoxStoreConfigAtAssemblyLocation.Text = Translator.GetText("Store config at the assembly location");
                buttonOpenAssemblyLocation.Text            = Translator.GetText("Open the assembly location");
                groupBoxAutostart.Text               = Translator.GetText("Autostart");
                checkBoxAutostart.Text               = Translator.GetText("Launch on startup");
                groupBoxHotkey.Text                  = Translator.GetText("Hotkey");
                buttonHotkeyDefault.Text             = Translator.GetText("Default");
                groupBoxLanguage.Text                = Translator.GetText("Language");
                groupBoxClick.Text                   = Translator.GetText("Click");
                checkBoxOpenItemWithOneClick.Text    = Translator.GetText("Single click to start item");
                groupBoxSizeAndLocation.Text         = Translator.GetText("Size and location");
                checkBoxAppearAtMouseLocation.Text   = Translator.GetText("Appear at mouse location");
                labelMaxMenuWidth.Text               = Translator.GetText("Pixels maximum menu width");
                labelMaxMenuHeight.Text              = Translator.GetText("Pixels maximum menu height");
                groupBoxStaysOpen.Text               = Translator.GetText("Stays open");
                checkBoxStayOpenWhenItemClicked.Text = Translator.GetText("If an item was clicked");
                checkBoxStayOpenWhenFocusLost.Text   = Translator.GetText("If the focus is lost and if the mouse is still on the menu");
                labelTimeUntilCloses.Text            = Translator.GetText("Milliseconds until the menu closes if in this case the mouse then leaves the menu");
                groupBoxOpenSubmenus.Text            = Translator.GetText("Time until a menu opens");
                labelTimeUntilOpen.Text              = Translator.GetText("Milliseconds until a menu opens when the mouse is on it");
                buttonAdvancedDefault.Text           = Translator.GetText("Default");
                groupBoxColorsLightMode.Text         = Translator.GetText("Colors Light Mode");
                groupBoxColorsDarkMode.Text          = Translator.GetText("Colors Dark Mode");
                labelMenuLightMode.Text              = Translator.GetText("Menu");
                labelMenuDarkMode.Text               = Translator.GetText("Menu");
                labelScrollbarLightMode.Text         = Translator.GetText("Scrollbar");
                labelScrollbarDarkMode.Text          = Translator.GetText("Scrollbar");
                checkBoxDarkModeAlwaysOn.Text        = Translator.GetText("Dark Mode always active");
                labelTitle.Text                                  = Translator.GetText("Title");
                labelTitleDarkMode.Text                          = Translator.GetText("Title");
                labelBackground.Text                             = Translator.GetText("Background");
                labelBackgroundDarkMode.Text                     = Translator.GetText("Background");
                labelSearchField.Text                            = Translator.GetText("Search field");
                labelSearchFieldDarkMode.Text                    = Translator.GetText("Search field");
                labelOpenFolder.Text                             = Translator.GetText("Opened folder");
                labelOpenFolderDarkMode.Text                     = Translator.GetText("Opened folder");
                labelOpenFolderBorder.Text                       = Translator.GetText("Border of opened folder");
                labelOpenFolderBorderDarkMode.Text               = Translator.GetText("Border of opened folder");
                labelSelectedItem.Text                           = Translator.GetText("Selected item");
                labelSelectedItemDarkMode.Text                   = Translator.GetText("Selected item");
                labelSelectedItemBorder.Text                     = Translator.GetText("Border of selected item");
                labelSelectedItemBorderDarkMode.Text             = Translator.GetText("Border of selected item");
                labelWarning.Text                                = Translator.GetText("Warning");
                labelWarningDarkMode.Text                        = Translator.GetText("Warning");
                labelScrollbarBackground.Text                    = Translator.GetText("Background");
                labelColorDarkModeScrollbarBackground.Text       = Translator.GetText("Background");
                labelSlider.Text                                 = Translator.GetText("Slider");
                labelColorDarkModeSlider.Text                    = Translator.GetText("Slider");
                labelSliderDragging.Text                         = Translator.GetText("Slider while dragging");
                labelColorDarkModeSliderDragging.Text            = Translator.GetText("Slider while dragging");
                labelSliderHover.Text                            = Translator.GetText("Slider while mouse hovers 1");
                labelColorDarkModeSliderHover.Text               = Translator.GetText("Slider while mouse hovers 1");
                labelSliderArrowsAndTrackHover.Text              = Translator.GetText("Slider while mouse hovers 2");
                labelColorDarkModeSliderArrowsAndTrackHover.Text = Translator.GetText("Slider while mouse hovers 2");
                labelArrow.Text                                  = Translator.GetText("Arrow");
                labelColorDarkModeArrow.Text                     = Translator.GetText("Arrow");
                labelArrowClick.Text                             = Translator.GetText("Arrow when clicking");
                labelColorDarkModeArrowClick.Text                = Translator.GetText("Arrow when clicking");
                labelArrowClickBackground.Text                   = Translator.GetText("Background of arrow when clicking");
                labelColorDarkModeArrowClickBackground.Text      = Translator.GetText("Background of arrow when clicking");
                labelArrowHover.Text                             = Translator.GetText("Arrow while mouse hovers");
                labelColorDarkModeArrowHover.Text                = Translator.GetText("Arrow while mouse hovers");
                labelArrowHoverBackground.Text                   = Translator.GetText("Background of arrow while mouse hovers");
                labelColorDarkModeArrowHoverBackground.Text      = Translator.GetText("Background of arrow while mouse hovers");

                buttonColorsDefault.Text         = Translator.GetText("Default");
                buttonColorsDefaultDarkMode.Text = Translator.GetText("Default");
                buttonOk.Text     = Translator.GetText("buttonOk");
                buttonCancel.Text = Translator.GetText("buttonCancel");
            }

            InitializeFolder();
            void InitializeFolder()
            {
                textBoxFolder.Text = Config.Path;
                checkBoxUseIconFromRootFolder.Checked =
                    Settings.Default.UseIconFromRootFolder;
            }

            InitializeAutostart();
            void InitializeAutostart()
            {
                checkBoxAutostart.Checked =
                    Settings.Default.IsAutostartActivated;
            }

            InitializeHotkey();
            void InitializeHotkey()
            {
                textBoxHotkey.SetHotkey(Settings.Default.HotKey);
            }

            InitializeLanguage();
            void InitializeLanguage()
            {
                List <Language> dataSource = new List <Language>
                {
                    new Language()
                    {
                        Name = "čeština", Value = "cs"
                    },
                    new Language()
                    {
                        Name = "Deutsch", Value = "de"
                    },
                    new Language()
                    {
                        Name = "English", Value = "en"
                    },
                    new Language()
                    {
                        Name = "Español", Value = "es"
                    },
                    new Language()
                    {
                        Name = "Français", Value = "fr"
                    },
                    new Language()
                    {
                        Name = "Italiano", Value = "it"
                    },
                    new Language()
                    {
                        Name = "Nederlands", Value = "nl"
                    },
                    new Language()
                    {
                        Name = "Português (Brasil)", Value = "pt-BR"
                    },
                    new Language()
                    {
                        Name = "中文(简体)", Value = "zh-CN"
                    },
                    new Language()
                    {
                        Name = "日本語", Value = "ja"
                    },
                    new Language()
                    {
                        Name = "한국어", Value = "ko"
                    },
                    new Language()
                    {
                        Name = "русский", Value = "ru"
                    },
                    new Language()
                    {
                        Name = "Tiếng Việt", Value = "vi"
                    },

                    // new Language() { Name = "русский", Value = "ru" },
                };

                comboBoxLanguage.DataSource    = dataSource;
                comboBoxLanguage.DisplayMember = "Name";
                comboBoxLanguage.ValueMember   = "Value";
                comboBoxLanguage.SelectedValue =
                    Settings.Default.CurrentCultureInfoName;
                if (comboBoxLanguage.SelectedValue == null)
                {
                    comboBoxLanguage.SelectedValue = "en";
                }
            }

            checkBoxStoreConfigAtAssemblyLocation.Checked = CustomSettingsProvider.IsActivatedConfigPathAssembly();

            checkBoxOpenItemWithOneClick.Checked  = Settings.Default.OpenItemWithOneClick;
            checkBoxAppearAtMouseLocation.Checked = Settings.Default.AppearAtMouseLocation;

            numericUpDownMenuWidth.Minimum   = 50;
            numericUpDownMenuWidth.Maximum   = 1000;
            numericUpDownMenuWidth.Increment = 10;
            numericUpDownMenuWidth.Value     = Settings.Default.MaximumMenuWidth;

            numericUpDownMenuHeight.Minimum   = 200;
            numericUpDownMenuHeight.Maximum   = 4000;
            numericUpDownMenuHeight.Increment = 10;
            numericUpDownMenuHeight.Value     = Settings.Default.MaximumMenuHeight;

            checkBoxStayOpenWhenItemClicked.Checked = Settings.Default.StaysOpenWhenItemClicked;
            checkBoxStayOpenWhenFocusLost.Checked   = Settings.Default.StaysOpenWhenFocusLost;

            numericUpDownTimeUntilClose.Minimum   = 200;
            numericUpDownTimeUntilClose.Maximum   = 5000;
            numericUpDownTimeUntilClose.Increment = 100;
            numericUpDownTimeUntilClose.Value     = Settings.Default.TimeUntilCloses;

            numericUpDownTimeUntilOpens.Minimum   = 20;
            numericUpDownTimeUntilOpens.Maximum   = 1000;
            numericUpDownTimeUntilOpens.Increment = 10;
            numericUpDownTimeUntilOpens.Value     = Settings.Default.TimeUntilOpens;

            checkBoxDarkModeAlwaysOn.Checked            = Settings.Default.IsDarkModeAlwaysOn;
            textBoxColorSelectedItem.Text               = Settings.Default.ColorSelectedItem;
            textBoxColorSelecetedItemDarkMode.Text      = Settings.Default.ColorDarkModeSelecetedItem;
            textBoxColorSelectedItemBorder.Text         = Settings.Default.ColorSelectedItemBorder;
            textBoxColorSelectedItemBorderDarkMode.Text = Settings.Default.ColorDarkModeSelectedItemBorder;
            textBoxColorOpenFolder.Text               = Settings.Default.ColorOpenFolder;
            textBoxColorOpenFolderDarkMode.Text       = Settings.Default.ColorDarkModeOpenFolder;
            textBoxColorOpenFolderBorder.Text         = Settings.Default.ColorOpenFolderBorder;
            textBoxColorOpenFolderBorderDarkMode.Text = Settings.Default.ColorDarkModeOpenFolderBorder;
            textBoxColorWarning.Text             = Settings.Default.ColorWarning;
            textBoxColorWarningDarkMode.Text     = Settings.Default.ColorDarkModeWarning;
            textBoxColorTitle.Text               = Settings.Default.ColorTitle;
            textBoxColorTitleDarkMode.Text       = Settings.Default.ColorDarkModeTitle;
            textBoxColorBackground.Text          = Settings.Default.ColorBackground;
            textBoxColorBackgroundDarkMode.Text  = Settings.Default.ColorDarkModeBackground;
            textBoxColorSearchField.Text         = Settings.Default.ColorSearchField;
            textBoxColorSearchFieldDarkMode.Text = Settings.Default.ColorDarkModeSearchField;

            textBoxColorScrollbarBackground.Text = Settings.Default.ColorScrollbarBackground;
            textBoxColorSlider.Text                    = Settings.Default.ColorSlider;
            textBoxColorSliderDragging.Text            = Settings.Default.ColorSliderDragging;
            textBoxColorSliderHover.Text               = Settings.Default.ColorSliderHover;
            textBoxColorSliderArrowsAndTrackHover.Text = Settings.Default.ColorSliderArrowsAndTrackHover;
            textBoxColorArrow.Text                             = Settings.Default.ColorArrow;
            textBoxColorArrowClick.Text                        = Settings.Default.ColorArrowClick;
            textBoxColorArrowClickBackground.Text              = Settings.Default.ColorArrowClickBackground;
            textBoxColorArrowHover.Text                        = Settings.Default.ColorArrowHover;
            textBoxColorArrowHoverBackground.Text              = Settings.Default.ColorArrowHoverBackground;
            textBoxColorScrollbarBackgroundDarkMode.Text       = Settings.Default.ColorScrollbarBackgroundDarkMode;
            textBoxColorSliderDarkMode.Text                    = Settings.Default.ColorSliderDarkMode;
            textBoxColorSliderDraggingDarkMode.Text            = Settings.Default.ColorSliderDraggingDarkMode;
            textBoxColorSliderHoverDarkMode.Text               = Settings.Default.ColorSliderHoverDarkMode;
            textBoxColorSliderArrowsAndTrackHoverDarkMode.Text = Settings.Default.ColorSliderArrowsAndTrackHoverDarkMode;
            textBoxColorArrowDarkMode.Text                     = Settings.Default.ColorArrowDarkMode;
            textBoxColorArrowClickDarkMode.Text                = Settings.Default.ColorArrowClickDarkMode;
            textBoxColorArrowClickBackgroundDarkMode.Text      = Settings.Default.ColorArrowClickBackgroundDarkMode;
            textBoxColorArrowHoverDarkMode.Text                = Settings.Default.ColorArrowHoverDarkMode;
            textBoxColorArrowHoverBackgroundDarkMode.Text      = Settings.Default.ColorArrowHoverBackgroundDarkMode;
        }
Exemplo n.º 2
0
        public SettingsForm()
        {
            InitializeComponent();

            // Initialize and replace here here, because designer always removes it
            InitializeTextBoxHotkeyAndReplacetextBoxHotkeyPlaceholder();
            void InitializeTextBoxHotkeyAndReplacetextBoxHotkeyPlaceholder()
            {
                textBoxHotkey = new HotkeyTextboxControl.HotkeyControl
                {
                    Hotkey          = Keys.None,
                    HotkeyModifiers = Keys.None,
                    Name            = "textBoxHotkey",
                    Size            = new Size(200, 20),
                    Text            = "None",
                };
                textBoxHotkey.Enter += new EventHandler(this.TextBoxHotkeyEnter);
                textBoxHotkey.Leave += new EventHandler(this.TextBoxHotkey_Leave);
                tableLayoutPanelHotkey.Controls.Remove(textBoxHotkeyPlaceholder);
                tableLayoutPanelHotkey.Controls.Add(textBoxHotkey, 0, 0);
            }

            // designer always resets it to 1
            this.tabControl.SelectedIndex = 0;

            Translate();
            void Translate()
            {
                Text = Translator.GetText("Settings");
                tabPageGeneral.Text                = Translator.GetText("General");
                tabPageAdvanced.Text               = Translator.GetText("Advanced");
                tabPageCustomize.Text              = Translator.GetText("Customize");
                groupBoxFolder.Text                = Translator.GetText("Folder");
                buttonChangeFolder.Text            = Translator.GetText("Change Folder");
                groupBoxAutostart.Text             = Translator.GetText("Autostart");
                checkBoxAutostart.Text             = Translator.GetText("Launch on startup");
                groupBoxHotkey.Text                = Translator.GetText("Hotkey");
                buttonHotkeyDefault.Text           = Translator.GetText("Default");
                groupBoxLanguage.Text              = Translator.GetText("Language");
                groupBoxClick.Text                 = Translator.GetText("Click");
                checkBoxOpenItemWithOneClick.Text  = Translator.GetText("Single click to start item");
                groupBoxSizeAndLocation.Text       = Translator.GetText("Size and location");
                checkBoxAppearAtMouseLocation.Text = Translator.GetText("Appear at mouse location");
                labelMaxMenuWidth.Text             = Translator.GetText("Pixels maximum menu width");
                groupBoxStaysOpen.Text             = Translator.GetText("Stays open");
                checkBoxStayOpenWhenFocusLost.Text = Translator.GetText("If the focus is lost and if the mouse is still on the menu");
                labelTimeUntilCloses.Text          = Translator.GetText("Milliseconds until the menu closes if in this case the mouse then leaves the menu");
                groupBoxOpenSubmenus.Text          = Translator.GetText("Time until a menu opens");
                labelTimeUntilOpen.Text            = Translator.GetText("Milliseconds until a menu opens when the mouse is on it");
                buttonAdvancedDefault.Text         = Translator.GetText("Default");
                groupBoxDarkMode.Text              = Translator.GetText("Dark Mode");
                checkBoxDarkModeAlwaysOn.Text      = Translator.GetText("Dark Mode always active");
                buttonOk.Text     = Translator.GetText("buttonOk");
                buttonCancel.Text = Translator.GetText("buttonCancel");
            }

            InitializeFolder();
            void InitializeFolder()
            {
                textBoxFolder.Text = Config.Path;
            }

            InitializeAutostart();
            void InitializeAutostart()
            {
                checkBoxAutostart.Checked =
                    Properties.Settings.Default.IsAutostartActivated;
            }

            InitializeHotkey();
            void InitializeHotkey()
            {
                textBoxHotkey.SetHotkey(Properties.Settings.Default.HotKey);
            }

            InitializeLanguage();
            void InitializeLanguage()
            {
                List <Language> dataSource = new List <Language>
                {
                    new Language()
                    {
                        Name = "English", Value = "en"
                    },
                    new Language()
                    {
                        Name = "Deutsch", Value = "de"
                    },
                    new Language()
                    {
                        Name = "Français", Value = "fr"
                    },
                    new Language()
                    {
                        Name = "Español", Value = "es"
                    },
                    new Language()
                    {
                        Name = "Italiano", Value = "it"
                    },
                    new Language()
                    {
                        Name = "Nederlands ", Value = "nl"
                    },
                };

                comboBoxLanguage.DataSource    = dataSource;
                comboBoxLanguage.DisplayMember = "Name";
                comboBoxLanguage.ValueMember   = "Value";
                comboBoxLanguage.SelectedValue =
                    Properties.Settings.Default.CurrentCultureInfoName;
                if (comboBoxLanguage.SelectedValue == null)
                {
                    comboBoxLanguage.SelectedValue = "en";
                }
            }

            checkBoxOpenItemWithOneClick.Checked  = Properties.Settings.Default.OpenItemWithOneClick;
            checkBoxAppearAtMouseLocation.Checked = Properties.Settings.Default.AppearAtMouseLocation;

            numericUpDownMenuWidth.Minimum   = 50;
            numericUpDownMenuWidth.Maximum   = 500;
            numericUpDownMenuWidth.Increment = 10;
            numericUpDownMenuWidth.Value     = Properties.Settings.Default.MaximumMenuWidth;

            checkBoxStayOpenWhenFocusLost.Checked = Properties.Settings.Default.StaysOpenWhenFocusLost;

            numericUpDownTimeUntilClose.Minimum   = 200;
            numericUpDownTimeUntilClose.Maximum   = 5000;
            numericUpDownTimeUntilClose.Increment = 100;
            numericUpDownTimeUntilClose.Value     = Properties.Settings.Default.TimeUntilCloses;

            numericUpDownTimeUntilOpens.Minimum   = 20;
            numericUpDownTimeUntilOpens.Maximum   = 1000;
            numericUpDownTimeUntilOpens.Increment = 10;
            numericUpDownTimeUntilOpens.Value     = Properties.Settings.Default.TimeUntilOpens;

            checkBoxDarkModeAlwaysOn.Checked = Properties.Settings.Default.IsDarkModeAlwaysOn;
        }