Ejemplo n.º 1
0
        /// <summary>
        /// CTOR
        /// </summary>
        public ShellSettingsFlyoutViewModel()
        {
            localizerService = Container.Resolve <ILocalizerService>(ServiceNames.LocalizerService);

            // create metro theme color menu items for the demo
            ApplicationThemes = ThemeManager.AppThemes
                                .Select(a => new ApplicationTheme()
            {
                Name             = a.Name,
                BorderColorBrush = a.Resources["BlackColorBrush"] as Brush,
                ColorBrush       = a.Resources["WhiteColorBrush"] as Brush
            })
                                .ToList();

            // create accent colors list
            AccentColors = ThemeManager.Accents
                           .Select(a => new AccentColor()
            {
                Name = a.Name, ColorBrush = a.Resources["AccentColorBrush"] as Brush
            })
                           .ToList();

            SelectedTheme       = ApplicationThemes.Where(c => c.Name.Equals(Properties.Settings.Default.Theme)).FirstOrDefault();
            SelectedAccentColor = AccentColors.Where(c => c.Name.Equals(Properties.Settings.Default.Color)).FirstOrDefault();
            SelectedLanguage    = SupportedLanguages.Where(c => c.Name.Equals(Properties.Settings.Default.Language)).FirstOrDefault();

            Container.Resolve <ILoggerFacade>().Log("ShellSettingsFlyoutViewModel created", Category.Info, Priority.None);
        }
        /// <summary>
        /// Load the saved theme and accent
        /// </summary>
        public void LoadSavedTheme()
        {
            // Get the saved theme and accent
            AppThemeMenuData    savedTheme  = AppThemes.Where(t => t.Name == Properties.Settings.Default.AppTheme).FirstOrDefault();
            AccentColorMenuData savedAccent = AccentColors.Where(a => a.Name == Properties.Settings.Default.AppAccent).FirstOrDefault();

            // Change to the saved theme and accent
            savedTheme?.ChangeAccentCommand.Execute(null);
            savedAccent?.ChangeAccentCommand.Execute(null);
        }
Ejemplo n.º 3
0
        private void WindowThemeUserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Window window = Window.GetWindow(this);

            window.Closing += window_Closing;

            // Get the saved theme and accent
            AppThemeMenuData    savedTheme  = AppThemes.Where(t => t.Name == Properties.Settings.Default.AppTheme).FirstOrDefault();
            AccentColorMenuData savedAccent = AccentColors.Where(a => a.Name == Properties.Settings.Default.AppAccent).FirstOrDefault();

            // Change to the saved theme and accent
            savedTheme?.ChangeAccentCommand.Execute(null);
            savedAccent?.ChangeAccentCommand.Execute(null);
        }