整理代码

This commit is contained in:
GG Z
2025-04-24 20:56:10 +08:00
parent 4d798e5d99
commit 155cef46f8
532 changed files with 1018 additions and 854 deletions

View File

@@ -0,0 +1,41 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace ShrlAlgo.RvKits.RvCommon;
public partial class AutoSaveViewModel : ObservableValidator
{
public AutoSaveViewModel()
{
IsActiveAutoSave = Properties.Settings.Default.IsActiveAutoSave;
IntervalTime = Properties.Settings.Default.AutoSaveIntervalTime;
}
[ObservableProperty]
private bool isActiveAutoSave;
//partial void OnIsActiveAutoSaveChanged(bool value)
//{
// throw new NotImplementedException();
//}
[Required(ErrorMessage = "不可为空")]
[DefaultValue(10)]
[NotifyDataErrorInfo]
[Range(1, 30, ErrorMessage = "输入值应在1~30分钟之间")]
[ObservableProperty]
private int intervalTime;
[RelayCommand]
private void Closing()
{
Properties.Settings.Default.IsActiveAutoSave = IsActiveAutoSave;
Properties.Settings.Default.AutoSaveIntervalTime = IntervalTime;
Properties.Settings.Default.Save();
Variables.AutoSaveTimer.Interval = IntervalTime * 60 * 1000;
}
}