Files
SzmediTools/Szmedi.RvKits/Common/TimerSetterWin.xaml.cs
2025-09-16 16:06:41 +08:00

47 lines
1.2 KiB
C#

using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
namespace Szmedi.RvKits.Common
{
/// <summary>
/// TimerSetterWin.xaml 的交互逻辑
/// </summary>
[ObservableObject]
public partial class TimerSetterWin
{
private int intervalTime;
public TimerSetterWin()
{
DataContext = this;
InitializeComponent();
AutoSave = Properties.Settings.Default.AutoSave;
IntervalTime = Properties.Settings.Default.AutoSaveIntervalTime;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.AutoSave = AutoSave;
Properties.Settings.Default.AutoSaveIntervalTime = IntervalTime;
Properties.Settings.Default.Save();
DialogResult = true;
}
[ObservableProperty]
private bool autoSave;
[Required]
[DefaultValue(15)]
[Range(1, 30)]
public int IntervalTime
{
get => intervalTime;
set => SetProperty(ref intervalTime, value);
}
}
}