-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlarmViewModel.cs
64 lines (56 loc) · 1.37 KB
/
AlarmViewModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
namespace AlarmApp
{
public class AlarmViewModel : ObservableObject
{
private string name = "Alarm 1";
public string Name
{
get => name;
set => SetProperty(ref name, value);
}
private DateTime _date;
public DateTime Date
{
get { return _date; }
set { SetProperty(ref _date, value); RelativeTime = Util.ConvertDateToRelative(Date); }
}
private uint id;
public uint Id
{
get => id;
set => SetProperty(ref id, value);
}
private string relativeTime = string.Empty;
public string RelativeTime
{
get => relativeTime;
set => SetProperty(ref relativeTime, value);
}
public void Update(DateTime date)
{
Date = date;
RelativeTime = Util.ConvertDateToRelative(_date);
}
}
/*
public class SubAlarmModel
{
public int OwnerAlarmId { get; set; }
public DateTime Date { get; set; }
}
public class SubAlarms
{
public List<SubAlarmModel> Alarms { get; set; } = new();
}
*/
public enum Times
{
Seconds,
Minutes,
Hours,
Days
}
}