Example #1
0
        private void UiHandler()
        {
            try
            {
                builder.Load();
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }

            //if a windows theme file was picked
            if (builder.Config.WindowsThemeMode.Enabled)
            {
                AccentColorCheckBox.IsEnabled = false;
                AccentColorCheckBox.ToolTip   = Properties.Resources.ToolTipDisabledDueTheme;
                SystemComboBox.IsEnabled      = false;
                SystemComboBox.ToolTip        = Properties.Resources.ToolTipDisabledDueTheme;
                AppComboBox.IsEnabled         = false;
                AppComboBox.ToolTip           = Properties.Resources.ToolTipDisabledDueTheme;
                NumberBoxColorDelay.IsEnabled = false;
                NumberBoxColorDelay.ToolTip   = Properties.Resources.ToolTipDisabledDueTheme;
            }

            //if the OS version is older than 1903
            if (int.Parse(RegistryHandler.GetOSversion()).CompareTo(1900) > 0)
            {
                is1903 = true;
            }
            if (!is1903)
            {
                SystemComboBox.IsEnabled            = false;
                SystemComboBox.ToolTip              = Properties.Resources.cmb1903;
                AccentColorCheckBox.IsEnabled       = false;
                AccentColorCheckBox.ToolTip         = Properties.Resources.cmb1903;
                builder.Config.SystemSwitch.Enabled = false;
                try
                {
                    builder.Save();
                }
                catch (Exception ex)
                {
                    ShowErrorMessage(ex);
                }
            }
            else
            //os version 1903+
            {
                //inform user about settings
                if (!builder.Config.WindowsThemeMode.Enabled)
                {
                    AccentColorCheckBox.ToolTip = Properties.Resources.cbAccentColor;
                }

                //numbox
                NumberBoxColorDelay.Value = Convert.ToInt32(builder.Config.SystemSwitch.Component.TaskbarSwitchDelay);

                //is accent color switch enabled?
                AccentColorCheckBox.IsChecked = builder.Config.SystemSwitch.Component.TaskbarColorOnDark;
                if (!AccentColorCheckBox.IsChecked.Value)
                {
                    TextBlockColorDelay.Visibility = Visibility.Collapsed;
                    NumberBoxColorDelay.Visibility = Visibility.Collapsed;
                }
            }

            //combobox
            if (builder.Config.AppsSwitch.Enabled)
            {
                AppComboBox.SelectedIndex = (int)builder.Config.AppsSwitch.Component.Mode;
            }
            else
            {
                AppComboBox.SelectedIndex = 3;
            }

            if (builder.Config.SystemSwitch.Enabled)
            {
                SystemComboBox.SelectedIndex = (int)builder.Config.SystemSwitch.Component.Mode;
            }
            else
            {
                SystemComboBox.SelectedIndex = 3;
            }

            if (builder.Config.OfficeSwitch.Enabled)
            {
                OfficeComboBox.SelectedIndex = (int)builder.Config.OfficeSwitch.Component.Mode;
            }
            else
            {
                OfficeComboBox.SelectedIndex = 3;
            }


            //checkbox
            if (builder.Config.OfficeSwitch.Component.LightTheme == 5)
            {
                CheckBoxOfficeWhiteTheme.IsChecked = true;
            }
        }
Example #2
0
        private void UiHandler()
        {
            try
            {
                builder.Load();
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }
            //if automatic theme switch isn't enabled
            if (!builder.Config.AutoThemeSwitchingEnabled)
            {
                AccentColorCheckBox.IsEnabled      = false;
                SystemComboBox.IsEnabled           = false;
                AppComboBox.IsEnabled              = false;
                EdgeComboBox.IsEnabled             = false;
                OfficeComboBox.IsEnabled           = false;
                CheckBoxOfficeWhiteTheme.IsEnabled = false;
            }

            //if a windows theme file was picked
            if (!builder.Config.ClassicMode)
            {
                AccentColorCheckBox.IsEnabled = false;
                AccentColorCheckBox.ToolTip   = Properties.Resources.ToolTipDisabledDueTheme;
                SystemComboBox.IsEnabled      = false;
                SystemComboBox.ToolTip        = Properties.Resources.ToolTipDisabledDueTheme;
                AppComboBox.IsEnabled         = false;
                AppComboBox.ToolTip           = Properties.Resources.ToolTipDisabledDueTheme;
            }

            //if the OS version is older than 1903
            if (int.Parse(RegistryHandler.GetOSversion()).CompareTo(1900) > 0)
            {
                is1903 = true;
            }
            if (!is1903)
            {
                SystemComboBox.IsEnabled      = false;
                SystemComboBox.ToolTip        = Properties.Resources.cmb1903;
                AccentColorCheckBox.IsEnabled = false;
                AccentColorCheckBox.ToolTip   = Properties.Resources.cmb1903;
            }
            else
            //os version 1903+
            {
                //inform user about settings
                if (builder.Config.ClassicMode)
                {
                    AccentColorCheckBox.ToolTip = Properties.Resources.cbAccentColor;
                }

                //is accent color switch enabled?
                AccentColorCheckBox.IsChecked = builder.Config.AccentColorTaskbarEnabled;
            }

            //combobox
            AppComboBox.SelectedIndex    = (int)builder.Config.AppsTheme;
            SystemComboBox.SelectedIndex = (int)builder.Config.SystemTheme;
            EdgeComboBox.SelectedIndex   = (int)builder.Config.EdgeTheme;
            if (builder.Config.Office.Enabled)
            {
                OfficeComboBox.SelectedIndex = (int)builder.Config.Office.Mode;
            }
            else
            {
                OfficeComboBox.SelectedIndex = 3;
            }


            //checkbox
            if (builder.Config.Office.LightTheme == 5)
            {
                CheckBoxOfficeWhiteTheme.IsChecked = true;
            }
        }
        private void UiHandler()
        {
            try
            {
                builder.Load();
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }

            //if a windows theme file was picked
            if (builder.Config.WindowsThemeMode.Enabled)
            {
                AccentColorCheckBox.IsEnabled         = false;
                AccentColorCheckBox.ToolTip           = AdmProperties.Resources.ToolTipDisabledDueTheme;
                TextBlockOfficeLabel.ToolTip          = "Only use with Office 2013-2019 or if you experience issues with Office's 'use system' setting";
                SystemComboBoxItemSwitch.ToolTip      = AdmProperties.Resources.ToolTipDisabledDueTheme;
                SystemComboBoxItemLightOnly.ToolTip   = AdmProperties.Resources.ToolTipDisabledDueTheme;
                SystemComboBoxItemLightOnly.IsEnabled = false;
                SystemComboBoxItemSwitch.IsEnabled    = false;
                SystemComboBoxItemDarkOnly.IsEnabled  = false;
                AppComboBox.IsEnabled         = false;
                AppComboBox.ToolTip           = AdmProperties.Resources.ToolTipDisabledDueTheme;
                NumberBoxColorDelay.IsEnabled = false;
                NumberBoxColorDelay.ToolTip   = AdmProperties.Resources.ToolTipDisabledDueTheme;
            }

            if (builder.Config.SystemSwitch.Enabled)
            {
                switch (builder.Config.SystemSwitch.Component.Mode)
                {
                case Mode.Switch:
                    if (builder.Config.WindowsThemeMode.Enabled)
                    {
                        SystemComboBox.SelectedItem = SystemComboBoxItemDisabled;
                    }
                    else
                    {
                        SystemComboBox.SelectedItem = SystemComboBoxItemSwitch;
                    }
                    break;

                case Mode.LightOnly:
                    if (builder.Config.WindowsThemeMode.Enabled)
                    {
                        SystemComboBox.SelectedItem = SystemComboBoxItemDisabled;
                    }
                    else
                    {
                        SystemComboBox.SelectedItem = SystemComboBoxItemLightOnly;
                    }
                    break;

                case Mode.DarkOnly:
                    if (builder.Config.WindowsThemeMode.Enabled)
                    {
                        SystemComboBox.SelectedItem = SystemComboBoxItemDisabled;
                    }
                    else
                    {
                        SystemComboBox.SelectedItem = SystemComboBoxItemDarkOnly;
                    }
                    break;

                case Mode.AccentOnly:
                    SystemComboBox.SelectedItem = SystemComboBoxItemAccentOnly;
                    break;
                }
                RadioButtonAdaptiveTaskbarAccentOnDark.IsChecked  = builder.Config.SystemSwitch.Component.TaskbarColorWhenNonAdaptive == Theme.Dark;
                RadioButtonAdaptiveTaskbarAccentOnLight.IsChecked = builder.Config.SystemSwitch.Component.TaskbarColorWhenNonAdaptive == Theme.Light;
            }
            else
            {
                SystemComboBox.SelectedItem = SystemComboBoxItemDisabled;
            }


            //if the OS version is older than 1903
            if (int.Parse(RegistryHandler.GetOSversion()).CompareTo(1900) > 0)
            {
                is1903 = true;
            }
            if (!is1903)
            {
                SystemComboBox.IsEnabled            = false;
                SystemComboBox.ToolTip              = AdmProperties.Resources.cmb1903;
                AccentColorCheckBox.IsEnabled       = false;
                AccentColorCheckBox.ToolTip         = AdmProperties.Resources.cmb1903;
                builder.Config.SystemSwitch.Enabled = false;
                try
                {
                    builder.Save();
                }
                catch (Exception ex)
                {
                    ShowErrorMessage(ex);
                }
            }
            else
            //os version 1903+
            {
                //inform user about settings
                if (!builder.Config.WindowsThemeMode.Enabled)
                {
                    AccentColorCheckBox.ToolTip = AdmProperties.Resources.cbAccentColor;
                }

                //numbox
                NumberBoxColorDelay.Value = Convert.ToInt32(builder.Config.SystemSwitch.Component.TaskbarSwitchDelay);

                AccentColorCheckBox.IsChecked = builder.Config.SystemSwitch.Component.TaskbarColorOnAdaptive;
                SystemComboBox_SelectionChanged(null, null);
            }

            //combobox
            if (builder.Config.AppsSwitch.Enabled)
            {
                AppComboBox.SelectedIndex = (int)builder.Config.AppsSwitch.Component.Mode;
            }
            else
            {
                AppComboBox.SelectedIndex = 3;
            }

            if (builder.Config.OfficeSwitch.Enabled)
            {
                if (builder.Config.OfficeSwitch.Component.Mode == Mode.FollowSystemTheme)
                {
                    OfficeComboBox.SelectedIndex       = 3;
                    CheckBoxOfficeWhiteTheme.IsEnabled = false;
                }
                else
                {
                    OfficeComboBox.SelectedIndex = (int)builder.Config.OfficeSwitch.Component.Mode;
                }
            }
            else
            {
                OfficeComboBox.SelectedIndex = 4;
            }


            //checkbox
            if (builder.Config.OfficeSwitch.Component.LightTheme == 5)
            {
                CheckBoxOfficeWhiteTheme.IsChecked = true;
            }
        }