bloxstrap/Bloxstrap/UI/ViewModels/Settings/MainWindowViewModel.cs
pizzaboxer 7e95fb4d8f
Deferred settings application system + new shortcut settings
this system took way too much effort to think of for some reason idk why
2024-08-13 00:10:18 +01:00

28 lines
695 B
C#

using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
namespace Bloxstrap.UI.ViewModels.Settings
{
public class MainWindowViewModel : NotifyPropertyChangedViewModel
{
public ICommand SaveSettingsCommand => new RelayCommand(SaveSettings);
public EventHandler? RequestSaveNoticeEvent;
private void SaveSettings()
{
App.Settings.Save();
App.State.Save();
App.FastFlags.Save();
foreach (var task in App.PendingSettingTasks)
task.Value.Execute();
App.PendingSettingTasks.Clear();
RequestSaveNoticeEvent?.Invoke(this, new EventArgs());
}
}
}