using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Windows; using CommunityToolkit.Mvvm.ComponentModel; namespace Szmedi.RvKits.Common { /// /// TimerSetterWin.xaml 的交互逻辑 /// [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); } } }