using System.Windows.Input; using SpdUp.Core; using SpdUp.Services; namespace SpdUp.ViewModels; /// /// Boost page ViewModel. /// public sealed class BoostViewModel : ObservableObject { private readonly MainViewModel _main; private readonly OptimizationService _optimizationService; private string _boostLog = string.Empty; public string BoostLog { get => _boostLog; set => SetProperty(ref _boostLog, value); } public MainViewModel Main => _main; public ICommand BoostCommand { get; } public ICommand CleanRamCommand { get; } public ICommand CleanShadersCommand { get; } public BoostViewModel(MainViewModel main, OptimizationService optimizationService) { _main = main; _optimizationService = optimizationService; BoostCommand = _main.BoostCommand; CleanRamCommand = _main.CleanRamCommand; CleanShadersCommand = _main.CleanShaderCacheCommand; _optimizationService.BoostActivated += msg => { BoostLog = $"[{DateTime.Now:HH:mm:ss}] BOOST ON\n{msg}\n\n{BoostLog}"; }; _optimizationService.BoostDeactivated += () => { BoostLog = $"[{DateTime.Now:HH:mm:ss}] BOOST OFF – Restored.\n\n{BoostLog}"; }; } }