Example #1
0
 public SettingsViewModel(
     IThemeService themeService,
     IApplicationInformationService applicationInformationService)
 {
     _themeService = themeService;
     _applicationInformationService = applicationInformationService;
     _elementTheme = _themeService.CurrentTheme;
 }
Example #2
0
        public async Task SetTheme(SpectroTheme theme)
        {
            CurrentTheme = theme;
            if (Window.Current.Content is FrameworkElement frameworkElement)
            {
                frameworkElement.RequestedTheme = theme.ToElementTheme();
            }

            _applicationSettingsService.Local.Set(RequestedThemeKey, await Json.StringifyAsync(theme));

            ThemeChanged?.Invoke(this, new ThemeChangedEventArgs(CurrentTheme));
        }
 public static ElementTheme ToElementTheme(this SpectroTheme theme) => (ElementTheme)(int)theme;
 public ThemeChangedEventArgs(SpectroTheme theme)
 {
     Theme = theme;
 }