Options fix
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
This commit is contained in:
@@ -1,20 +1,84 @@
|
||||
using cfs_tracker.Models;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace cfs_tracker.ViewModels;
|
||||
|
||||
public partial class NotificationScheduleItemViewModel : ObservableObject
|
||||
{
|
||||
public int Id { get; init; }
|
||||
|
||||
public ObservableCollection<WeekdayOptionItemViewModel> WeekdayOptions { get; } = new();
|
||||
public int Id { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private WeekdayOptionItemViewModel? selectedWeekday;
|
||||
private TimeSpan selectedTime;
|
||||
|
||||
[ObservableProperty]
|
||||
private TimeSpan selectedTime = new(9, 0, 0);
|
||||
private bool isEnabled;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isEnabled = true;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user