d11f0e46c0
clean up and fixes - Heute gefixt - Code Cleanup NotificationScheduleItemViewModel -fixed NotificationScheduleItemViewModel for Windows compat push implementation Push fixes Push benachrichtungen eingebaut - Status bei push - Push auch in background - Toggle für symtome angepasst push system change exporter update Optionen fix - Optionen aufgeteilt auf 3 tabs - Anpassungen haben jetzt Farbslider Optimierung fix
84 lines
2.7 KiB
C#
84 lines
2.7 KiB
C#
using cfs_tracker.Models;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace cfs_tracker.ViewModels;
|
|
|
|
public partial class NotificationScheduleItemViewModel : ObservableObject
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
[ObservableProperty]
|
|
private TimeSpan selectedTime;
|
|
|
|
[ObservableProperty]
|
|
private bool isEnabled;
|
|
|
|
[ObservableProperty]
|
|
private bool monday;
|
|
|
|
[ObservableProperty]
|
|
private bool tuesday;
|
|
|
|
[ObservableProperty]
|
|
private bool wednesday;
|
|
|
|
[ObservableProperty]
|
|
private bool thursday;
|
|
|
|
[ObservableProperty]
|
|
private bool friday;
|
|
|
|
[ObservableProperty]
|
|
private bool saturday;
|
|
|
|
[ObservableProperty]
|
|
private bool sunday;
|
|
|
|
public IRelayCommand ToggleMondayCommand { get; }
|
|
public IRelayCommand ToggleTuesdayCommand { get; }
|
|
public IRelayCommand ToggleWednesdayCommand { get; }
|
|
public IRelayCommand ToggleThursdayCommand { get; }
|
|
public IRelayCommand ToggleFridayCommand { get; }
|
|
public IRelayCommand ToggleSaturdayCommand { get; }
|
|
public IRelayCommand ToggleSundayCommand { get; }
|
|
|
|
public NotificationScheduleItemViewModel()
|
|
{
|
|
ToggleMondayCommand = new RelayCommand(() => Monday = !Monday);
|
|
ToggleTuesdayCommand = new RelayCommand(() => Tuesday = !Tuesday);
|
|
ToggleWednesdayCommand = new RelayCommand(() => Wednesday = !Wednesday);
|
|
ToggleThursdayCommand = new RelayCommand(() => Thursday = !Thursday);
|
|
ToggleFridayCommand = new RelayCommand(() => Friday = !Friday);
|
|
ToggleSaturdayCommand = new RelayCommand(() => Saturday = !Saturday);
|
|
ToggleSundayCommand = new RelayCommand(() => Sunday = !Sunday);
|
|
}
|
|
|
|
public int ToWeekdayMask()
|
|
{
|
|
var mask = NotificationWeekdays.None;
|
|
|
|
if (Monday) mask |= NotificationWeekdays.Monday;
|
|
if (Tuesday) mask |= NotificationWeekdays.Tuesday;
|
|
if (Wednesday) mask |= NotificationWeekdays.Wednesday;
|
|
if (Thursday) mask |= NotificationWeekdays.Thursday;
|
|
if (Friday) mask |= NotificationWeekdays.Friday;
|
|
if (Saturday) mask |= NotificationWeekdays.Saturday;
|
|
if (Sunday) mask |= NotificationWeekdays.Sunday;
|
|
|
|
return (int)mask;
|
|
}
|
|
|
|
public void LoadFromWeekdayMask(int mask)
|
|
{
|
|
var flags = (NotificationWeekdays)mask;
|
|
|
|
Monday = flags.HasFlag(NotificationWeekdays.Monday);
|
|
Tuesday = flags.HasFlag(NotificationWeekdays.Tuesday);
|
|
Wednesday = flags.HasFlag(NotificationWeekdays.Wednesday);
|
|
Thursday = flags.HasFlag(NotificationWeekdays.Thursday);
|
|
Friday = flags.HasFlag(NotificationWeekdays.Friday);
|
|
Saturday = flags.HasFlag(NotificationWeekdays.Saturday);
|
|
Sunday = flags.HasFlag(NotificationWeekdays.Sunday);
|
|
}
|
|
} |