mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-23 02:51:26 -07:00
38 lines
995 B
C#
38 lines
995 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()
|
|
{
|
|
const string LOG_IDENT = "MainWindowViewModel::SaveSettings";
|
|
|
|
App.Settings.Save();
|
|
App.State.Save();
|
|
App.FastFlags.Save();
|
|
|
|
foreach (var pair in App.PendingSettingTasks)
|
|
{
|
|
var task = pair.Value;
|
|
|
|
if (task.Changed)
|
|
{
|
|
App.Logger.WriteLine(LOG_IDENT, $"Executing pending task '{task}'");
|
|
task.Execute();
|
|
}
|
|
}
|
|
|
|
App.PendingSettingTasks.Clear();
|
|
|
|
RequestSaveNoticeEvent?.Invoke(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|