12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using CommunityToolkit.Mvvm.ComponentModel;
- using CommunityToolkit.Mvvm.Input;
- using DialogHostAvalonia;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace InABox.Avalonia.Components.TimeSelector;
- public partial class TimeSelectorViewModel : BasePopupViewModel<TimeSpan?>
- {
- [ObservableProperty]
- private TimeSpan? _time;
- [ObservableProperty]
- private Func<TimeSpan?>? _getTime;
- [RelayCommand]
- private void Cancel()
- {
- Close(null);
- }
- [RelayCommand]
- private void Clear()
- {
- Close(TimeSpan.MinValue);
- }
- [RelayCommand]
- private void Now()
- {
- Close(DateTime.Now.TimeOfDay);
- }
- [RelayCommand]
- private void Select()
- {
- Close(GetTime is null ? Time : GetTime());
- }
- }
|