예제 #1
0
        private void SetThemeElements(TemplateUISettings setting)
        {
            if (setting.IsDarkMode)
            {
                DarkModeToggleSwitch.IsOn = true;
                ThemeManager.Current.ChangeTheme(this, $"Dark.{setting.Color}");
            }
            else
            {
                DarkModeToggleSwitch.IsOn = false;
                ThemeManager.Current.ChangeTheme(this, $"Light.{setting.Color}");
            }

            foreach (UIElement el in AccentColorPanel.Children)
            {
                RadioButton rb    = el as RadioButton;
                string      value = rb.Name.Replace("Radio", "");
                if (setting.Color == value)
                {
                    rb.IsChecked = true;
                }
            }
            FontFamilyComboBox.Text   = setting.FontFamily;
            FontSizeSelectorBox.Value = setting.FontSize;

            FontFamilyComboBox.FontFamily = new FontFamily(setting.FontFamily);
            FontFamilyComboBox.FontSize   = setting.FontSize;

            DataEntryBox.FontFamily = new FontFamily(setting.FontFamily);
            DataEntryBox.FontSize   = setting.FontSize;
        }
        private void SetTheme(TemplateUISettings settings)
        {
            UISettings  = settings;
            DataContext = UISettings;
            if (settings.IsDarkMode)
            {
                ThemeManager.Current.ChangeTheme(this, $"Dark.{settings.Color}");
            }
            else
            {
                ThemeManager.Current.ChangeTheme(this, $"Light.{settings.Color}");
            }

            foreach (UIElement el in GenericInfoGrid.Children)
            {
                if (el.GetType() == typeof(TextBox))
                {
                    ((TextBox)(el)).FontFamily = new FontFamily(settings.FontFamily);
                    ((TextBox)(el)).FontSize   = settings.FontSize;
                }
            }
            foreach (UIElement el in DeviceInfoGrid.Children)
            {
                if (el.GetType() == typeof(ComboBox))
                {
                    ((ComboBox)(el)).FontFamily = new FontFamily(settings.FontFamily);
                    ((ComboBox)(el)).FontSize   = settings.FontSize;
                }
                if (el.GetType() == typeof(TextBox))
                {
                    ((TextBox)(el)).FontFamily = new FontFamily(settings.FontFamily);
                    ((TextBox)(el)).FontSize   = settings.FontSize;
                }
            }
            foreach (UIElement el in SoftwareInfoGrid.Children)
            {
                if (el.GetType() == typeof(ComboBox))
                {
                    ((ComboBox)(el)).FontFamily = new FontFamily(settings.FontFamily);
                    ((ComboBox)(el)).FontSize   = settings.FontSize;
                }
                if (el.GetType() == typeof(TextBox))
                {
                    ((TextBox)(el)).FontFamily = new FontFamily(settings.FontFamily);
                    ((TextBox)(el)).FontSize   = settings.FontSize;
                }
            }
            foreach (UIElement el in RemoteSessionsGrid.Children)
            {
                if (el.GetType() == typeof(TextBox))
                {
                    ((TextBox)(el)).FontFamily = new FontFamily(settings.FontFamily);
                    ((TextBox)(el)).FontSize   = settings.FontSize;
                }
            }
            TemplatePreviewBox.FontFamily = new FontFamily(settings.FontFamily);
            TemplatePreviewBox.FontSize   = settings.FontSize;
            BlankField.FontFamily         = new FontFamily(settings.FontFamily);
            BlankField.FontSize           = settings.FontSize;
        }
        public MainWindow()
        {
            InitializeComponent();
            Ginfo       = new GenericInfo();
            Pinfo       = new ProductInfo();
            _UISettings = new TemplateUISettings()
            {
                Color      = Properties.Settings.Default.Color,
                IsDarkMode = Properties.Settings.Default.IsDarkMode,
                FontFamily = Properties.Settings.Default.FontFamily,
                FontSize   = Properties.Settings.Default.FontSize
            };
            LogWriter.CreateTodaysLog();

            KeyBinding OpenCmdKeyBinding = new KeyBinding(
                ApplicationCommands.New,
                Key.R,
                ModifierKeys.Control);

            this.InputBindings.Add(OpenCmdKeyBinding);


            //Initial setup process.
            FillComboBoxes();

            SetTheme(new TemplateUISettings()
            {
                Color      = Properties.Settings.Default.Color,
                IsDarkMode = Properties.Settings.Default.IsDarkMode,
                FontFamily = Properties.Settings.Default.FontFamily,
                FontSize   = Properties.Settings.Default.FontSize
            });
            DataContext = UISettings;
            ContactNameBox.Focus();
        }
예제 #4
0
        private void SaveSettings(TemplateUISettings settings)
        {
            //saves font family
            Properties.Settings.Default.FontFamily = settings.FontFamily;

            //checks if it is real, and adds it to the family list
            if (IsValidFont(settings.FontFamily) &&
                !Properties.Settings.Default.FontFamilyList.Contains(settings.FontFamily))
            {
                Properties.Settings.Default.FontFamilyList.Add(settings.FontFamily);
            }

            Properties.Settings.Default.FontSize   = settings.FontSize;
            Properties.Settings.Default.Color      = settings.Color;
            Properties.Settings.Default.IsDarkMode = settings.IsDarkMode;
            Properties.Settings.Default.Save();
        }
예제 #5
0
 public PreferencesWindow()
 {
     CurrentSettings = new TemplateUISettings()
     {
         Color      = Properties.Settings.Default.Color,
         IsDarkMode = Properties.Settings.Default.IsDarkMode,
         FontFamily = Properties.Settings.Default.FontFamily,
         FontSize   = Properties.Settings.Default.FontSize
     };
     NewSettings = new TemplateUISettings();
     InitializeComponent();
     SetThemeElements(CurrentSettings);
     FontFamilyComboBox.Text = IsValidFont(CurrentSettings.FontFamily) ? CurrentSettings.FontFamily : "Segoe UI";
     foreach (var item in Properties.Settings.Default.FontFamilyList)
     {
         FontFamilyComboBox.Items.Add(item);
     }
 }
예제 #6
0
        private TemplateUISettings GetTemporarySettings()
        {
            TemplateUISettings tempSettings = new TemplateUISettings()
            {
                FontFamily = FontFamilyComboBox.Text,
                FontSize   = (int)FontSizeSelectorBox.Value,
                IsDarkMode = DarkModeToggleSwitch.IsOn
            };

            foreach (UIElement el in AccentColorPanel.Children)
            {
                RadioButton rb = el as RadioButton;
                if (rb.IsChecked.Value)
                {
                    tempSettings.Color = rb.Name.Replace("Radio", "");
                }
            }
            return(tempSettings);
        }