withSIX.Play.Applications.ViewModels.Overlays.SettingsViewModel.SettingsViewModel C# (CSharp) Method

SettingsViewModel() public method

public SettingsViewModel ( UserSettings settings, IDialogManager dialogManager, IRestarter restarter ) : System
settings withSIX.Play.Core.Options.UserSettings
dialogManager IDialogManager
restarter IRestarter
return System
        public SettingsViewModel(UserSettings settings, IDialogManager dialogManager, IRestarter restarter) {
            _dialogManager = dialogManager;
            DisplayName = "Settings";
            _settings = settings;

            // create accent color menu items for the demo
            Accents = ThemeInfo.Accents
                .Select(
                    a => new AccentColorMenuData {Name = a.Name, ColorBrush = a.ColorBrush}).ToList();

            // create metro theme color menu items for the demo
            Themes = ThemeInfo.Themes
                .Select(
                    a =>
                        new AppThemeMenuData {
                            Name = a.Name,
                            BorderColorBrush = a.BorderColorBrush,
                            ColorBrush = a.ColorBrush
                        }).ToList();

            DiagnosticsMenu = new DiagnosticsMenu(_dialogManager, restarter);

            // Task.Run because RXCommand does not throw exceptions in Subscribe.
            ReactiveCommand.CreateAsyncTask(x => Task.Run(() => Logout()))
                .SetNewCommand(this, x => x.LogoutCommand)
                .Subscribe();
            ReactiveCommand.CreateAsyncTask(
                x => Cheat.PublishEventUi(new RequestGameSettingsOverlay(Guid.Empty)))
                .SetNewCommand(this, x => x.GameSettingsCommand)
                .Subscribe();

            _settings.WhenAnyValue(x => x.GameOptions.SteamDirectory)
                .BindTo(this, x => x.SteamDirectory);

            this.WhenAnyValue(x => x.SteamDirectory)
                .Select(x => x == DefaultSteamDirectory ? null : x)
                .Where(x => x == null || x.IsValidAbsoluteDirectoryPath())
                .BindTo(_settings.GameOptions, x => x.SteamDirectory);

            this.WhenAnyValue(x => x.DefaultSteamDirectory)
                .Where(x => string.IsNullOrWhiteSpace(SteamDirectory) && !string.IsNullOrWhiteSpace(x))
                .Subscribe(x => SteamDirectory = x);

            SetupPropertyGrid();
        }

Same methods

SettingsViewModel::SettingsViewModel ( ) : System