8 |
8 |
9 namespace FingersDance.ViewModels |
9 namespace FingersDance.ViewModels |
10 { |
10 { |
11 public class AnnotationViewModel : ViewModelBase |
11 public class AnnotationViewModel : ViewModelBase |
12 { |
12 { |
13 private float _tcBegin; |
13 readonly Annotation a; |
14 private float _dur; |
|
15 private String _gestureType; |
|
16 private Color _color; |
|
17 |
14 |
18 private float _marginLeft; |
15 private float _marginLeft; |
19 private Double _scaleX = 1; |
16 private Double _scaleX = 1; |
20 |
17 |
21 public AnnotationViewModel(Annotation a, float marginLeft, Double scaleX) |
18 public AnnotationViewModel(Annotation aPar, float marginLeft, Double scaleX) |
22 { |
19 { |
23 this._tcBegin = a.TcBegin; |
20 a = aPar; |
24 this._dur = a.Dur; |
21 |
25 this._gestureType = a.GestureType; |
|
26 this._color = a.Color; |
|
27 this._marginLeft = marginLeft; |
22 this._marginLeft = marginLeft; |
28 this._marginLeft = marginLeft; |
23 this._marginLeft = marginLeft; |
29 this._scaleX = scaleX; |
24 this._scaleX = scaleX; |
30 } |
25 } |
31 public AnnotationViewModel(Annotation a, float marginLeft) |
26 public AnnotationViewModel(Annotation aPar, float marginLeft) |
32 { |
27 { |
33 this._tcBegin = a.TcBegin; |
28 a = aPar; |
34 this._dur = a.Dur; |
29 |
35 this._gestureType = a.GestureType; |
|
36 this._color = a.Color; |
|
37 this._marginLeft = marginLeft; |
30 this._marginLeft = marginLeft; |
38 } |
31 } |
39 |
32 |
40 public float TcBegin |
33 public float TcBegin |
41 { |
34 { |
42 get { return _tcBegin; } |
35 get { return a.TcBegin; } |
43 set |
36 set |
44 { |
37 { |
45 if (value == _tcBegin || float.IsNaN(value)) |
38 if (value == a.TcBegin || float.IsNaN(value)) |
46 return; |
39 return; |
47 _tcBegin = value; |
40 a.TcBegin = value; |
48 base.OnPropertyChanged("TcBegin"); |
41 base.OnPropertyChanged("TcBegin"); |
49 } |
42 } |
50 } |
43 } |
51 public float Dur |
44 public float Dur |
52 { |
45 { |
53 get { return _dur; } |
46 get { return a.Dur; } |
54 set |
47 set |
55 { |
48 { |
56 if (value == _dur || float.IsNaN(value)) |
49 if (value == a.Dur || float.IsNaN(value)) |
57 return; |
50 return; |
58 _dur = value; |
51 a.Dur = value; |
59 base.OnPropertyChanged("Dur"); |
52 base.OnPropertyChanged("Dur"); |
60 } |
53 } |
61 } |
54 } |
62 public String GestureType |
55 public String GestureType |
63 { |
56 { |
64 get { return _gestureType; } |
57 get { return a.GestureType; } |
65 set |
58 set |
66 { |
59 { |
67 if (value == _gestureType || String.IsNullOrEmpty(value)) |
60 if (value == a.GestureType || String.IsNullOrEmpty(value)) |
68 return; |
61 return; |
69 _gestureType = value; |
62 a.GestureType = value; |
70 base.OnPropertyChanged("GestureType"); |
63 base.OnPropertyChanged("GestureType"); |
71 } |
64 } |
72 } |
65 } |
73 public Color Color |
66 public Color Color |
74 { |
67 { |
75 get { return _color; } |
68 get { return a.Color; } |
76 set |
69 set |
77 { |
70 { |
78 if (value == _color) |
71 if (value == a.Color) |
79 return; |
72 return; |
80 _color = value; |
73 a.Color = value; |
81 } |
74 } |
82 } |
75 } |
83 public float MarginLeft |
76 public float MarginLeft |
84 { |
77 { |
85 get { return _marginLeft; } |
78 get { return _marginLeft; } |