public AppearanceManagerViewModel(IAppearanceSettings settings)
        {
            _settings = settings;

            _themes        = new ObservableCollection <ThemeResource>(AppearanceManager.GetThemes());
            _selectedTheme = (from t in _themes where t.Name == _settings.Theme select t).FirstOrDefault();

            if (_selectedTheme == null)
            {
                SelectedTheme = CurrentTheme;
            }
            SelectedTheme.Apply();

            _accents         = new ObservableCollection <AccentResource>(AppearanceManager.GetAccents());
            _accentGroups    = new ObservableCollection <string>((from a in _accents orderby a.SortOrder ascending select a.AccentGroup).Distinct().ToList());
            _accentGroupings = new CollectionViewSource {
                Source = _accents
            };
            _accentGroupings.Filter += AccentGroupingsOnFilter;
            _accentGroupings.SortDescriptions.Add(new SortDescription("SortOrder", ListSortDirection.Ascending));

            _selectedAccent = (from a in _accents where a.Name == _settings.Accent select a).FirstOrDefault();

            if (_selectedAccent == null)
            {
                SelectedAccent = CurrentAccent;
            }
            SelectedAccent.Apply();

            ApplyCommand  = new DelegateCommand(Apply, CanExecuteApply);
            CancelCommand = new DelegateCommand(Cancel, CanExecuteCancel);
        }
        private void Apply()
        {
            _isApplying = true;
            RaisePropertyChanged("CanCancel");
            RaisePropertyChanged("CanApply");
            ApplyCommand.RaiseCanExecuteChanged();

            if (!Equals(SelectedAccent, CurrentAccent))
            {
                SelectedAccent.Apply();
            }

            if (!Equals(SelectedTheme, CurrentTheme))
            {
                SelectedTheme.Apply();
            }

            _settings.Save();

            _isApplying = false;
            RaisePropertyChanged("CanCancel");
            RaisePropertyChanged("CanApply");
            ApplyCommand.RaiseCanExecuteChanged();
        }