forked from capnfabs/timecard-wp7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PunchSet.cs
98 lines (92 loc) · 2.39 KB
/
PunchSet.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO.IsolatedStorage;
namespace Timecard
{
public enum PunchTypes
{
StartWork,
EndWork,
StartProject,
EndProject,
StartBreak,
EndBreak
}
public class PunchSet
{
public ObservableCollection<Punch> Punches { get; set; }
public PunchSet ()
{
Punches = new ObservableCollection<Punch>();
}
}
public class Punch : INotifyPropertyChanged
{
private DateTime _time;
private String _punchLabel;
private PunchTypes _punchType;
public event PropertyChangedEventHandler PropertyChanged;
public PunchTypes PunchType
{
get
{
return _punchType;
}
set
{
_punchType = value;
OnPropertyChanged(new PropertyChangedEventArgs("PunchType"));
}
}
public DateTime Time
{
get
{
return _time;
}
set
{
_time = value;
OnPropertyChanged(new PropertyChangedEventArgs("Time"));
}
}
public String PunchLabel
{
get
{
return _punchLabel;
}
set
{
_punchLabel = value;
OnPropertyChanged(new PropertyChangedEventArgs("PunchLabel"));
}
}
public Punch()
{
Time = new DateTime();
PunchLabel = "";
}
public Punch(DateTime aTime, String aPunchLabel, PunchTypes aPunchType)
{
Time = aTime;
PunchLabel = aPunchLabel;
PunchType = aPunchType;
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
{
if (PropertyChanged != null)
PropertyChanged(this, args);
}
}
}