using System.Windows.Input; using SpdUp.Core; using SpdUp.Models; namespace SpdUp.ViewModels; /// /// Settings page ViewModel. /// public sealed class SettingsViewModel : ObservableObject { private readonly AppSettings _settings; private readonly MainViewModel _main; public bool AutoDetectGames { get => _settings.AutoDetectGames; set { _settings.AutoDetectGames = value; OnPropertyChanged(); Save(); } } public bool AutoBoostOnGameLaunch { get => _settings.AutoBoostOnGameLaunch; set { _settings.AutoBoostOnGameLaunch = value; OnPropertyChanged(); Save(); } } public bool MinimizeToTray { get => _settings.MinimizeToTray; set { _settings.MinimizeToTray = value; OnPropertyChanged(); Save(); } } public bool StartWithWindows { get => _settings.StartWithWindows; set { _settings.StartWithWindows = value; OnPropertyChanged(); Save(); } } public bool WidgetCompactMode { get => _settings.WidgetCompactMode; set { _settings.WidgetCompactMode = value; OnPropertyChanged(); Save(); } } public double WidgetOpacity { get => _settings.WidgetOpacity; set { _settings.WidgetOpacity = value; OnPropertyChanged(); Save(); } } public int WidgetUpdateInterval { get => _settings.WidgetUpdateIntervalMs; set { _settings.WidgetUpdateIntervalMs = value; OnPropertyChanged(); Save(); } } public bool WidgetClickThrough { get => _settings.WidgetClickThrough; set { _settings.WidgetClickThrough = value; OnPropertyChanged(); Save(); } } public int MonitoringInterval { get => _settings.MonitoringIntervalMs; set { _settings.MonitoringIntervalMs = value; OnPropertyChanged(); Save(); } } public string PingTarget { get => _settings.PingTarget; set { _settings.PingTarget = value; OnPropertyChanged(); Save(); } } public string PreferredDns { get => _settings.PreferredDns; set { _settings.PreferredDns = value; OnPropertyChanged(); Save(); } } public ICommand SaveCommand { get; } public SettingsViewModel(AppSettings settings, MainViewModel main) { _settings = settings; _main = main; SaveCommand = new RelayCommand(Save); } private void Save() => _settings.Save(); }