Пример #1
0
 /// <inheritdoc />
 public override void Commit()
 {
     // Manually commit
     UiConfiguration.CommitTransaction();
     // Manually commit
     _metroThemeManager.ChangeTheme(UiConfiguration.Theme, UiConfiguration.ThemeColor);
 }
Пример #2
0
        public override void Initialize(IConfig config)
        {
            // Prepare disposables
            _disposables?.Dispose();
            _disposables = new CompositeDisposable();

            AvailableThemes.Clear();
            foreach (var theme in MetroThemeManager.AvailableThemes)
            {
                AvailableThemes.Add(theme);
            }
            foreach (var themeColor in MetroThemeManager.AvailableThemeColors)
            {
                AvailableThemeColors.Add(themeColor);
            }

            // Place this under the Ui parent
            ParentId = nameof(ConfigIds.Ui);

            // Make sure Commit/Rollback is called on the UiConfiguration
            config.Register(UiConfiguration);

            // automatically update the DisplayName
            _disposables.Add(UiTranslations.CreateDisplayNameBinding(this, nameof(IConfigTranslations.Theme)));

            // Automatically show theme changes
            _disposables.Add(
                UiConfiguration.OnPropertyChanging(nameof(UiConfiguration.Theme)).Subscribe(args =>
            {
                if (args is PropertyChangingEventArgsEx propertyChangingEventArgsEx)
                {
                    _metroThemeManager.ChangeTheme(propertyChangingEventArgsEx.NewValue as string, null);
                }
            })
                );
            _disposables.Add(
                UiConfiguration.OnPropertyChanging(nameof(UiConfiguration.ThemeColor)).Subscribe(args =>
            {
                if (args is PropertyChangingEventArgsEx propertyChangingEventArgsEx)
                {
                    _metroThemeManager.ChangeTheme(null, propertyChangingEventArgsEx.NewValue as string);
                }
            })
                );
            base.Initialize(config);
        }
Пример #3
0
 protected bool Equals(UiConfiguration other)
 {
     return string.Equals(Language, other.Language);
 }
Пример #4
0
 /// <inheritdoc />
 public override void Terminate()
 {
     UiConfiguration.RollbackTransaction();
     _metroThemeManager.ChangeTheme(UiConfiguration.Theme, UiConfiguration.ThemeColor);
 }