Mercurial > silverbladetech
annotate Chronosv2/source/Presentation/ViewModel/ObservableObject.cs @ 10:443821e55f06
Initial cleaned up add from Codeplex files
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Tue, 21 Feb 2012 17:25:44 +0700 |
parents | |
children |
rev | line source |
---|---|
10
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
1 /* |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
2 The MIT License |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
3 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
4 Copyright (c) 2009-2010. Carlos Guzmán Álvarez. http://chronoswpf.codeplex.com/ |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
5 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
6 Permission is hereby granted, free of charge, to any person obtaining a copy |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
7 of this software and associated documentation files (the "Software"), to deal |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
8 in the Software without restriction, including without limitation the rights |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
10 copies of the Software, and to permit persons to whom the Software is |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
11 furnished to do so, subject to the following conditions: |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
12 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
13 The above copyright notice and this permission notice shall be included in |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
14 all copies or substantial portions of the Software. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
15 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
22 THE SOFTWARE. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
23 */ |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
24 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
25 using System; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
26 using System.ComponentModel; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
27 using System.Linq.Expressions; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
28 using System.Windows.Threading; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
29 using Chronos.Presentation.Core.ViewModel; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
30 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
31 namespace Chronos.Presentation.ViewModel |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
32 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
33 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
34 /// Base class for observable objects viewmodels |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
35 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
36 public abstract class ObservableObject |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
37 : IObservableObject |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
38 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
39 #region · Static Methods · |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
40 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
41 public static PropertyChangedEventArgs CreateArgs<T>(Expression<Func<T, object>> propertyExpression) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
42 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
43 return new PropertyChangedEventArgs(propertyExpression.GetPropertyName()); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
44 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
45 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
46 #endregion |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
47 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
48 #region · INotifyPropertyChanged Members · |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
49 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
50 public event PropertyChangedEventHandler PropertyChanged; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
51 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
52 #endregion |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
53 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
54 #region · Fields · |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
55 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
56 private readonly Dispatcher dispatcher; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
57 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
58 #endregion |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
59 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
60 #region · Protected Properties · |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
61 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
62 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
63 /// Gets the Dispatcher this DispatcherObject is associated with. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
64 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
65 protected Dispatcher Dispatcher |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
66 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
67 get { return this.dispatcher; } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
68 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
69 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
70 #endregion |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
71 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
72 #region · Constructors · |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
73 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
74 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
75 /// Initializes a new instance of the <see cref="ObservableObject"/> class. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
76 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
77 protected ObservableObject() |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
78 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
79 this.dispatcher = Dispatcher.CurrentDispatcher; |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
80 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
81 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
82 #endregion |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
83 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
84 #region · Protected Methods · |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
85 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
86 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
87 /// Executes the specified <see cref="Action "/> at the <see cref="DispatcherPriority.ApplicationIdle"/> priority |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
88 /// on the thread on which the DispatcherObject is associated with. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
89 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
90 /// <param name="dispatcherObject">The dispatcher object.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
91 /// <param name="action">The action.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
92 protected void InvokeAsynchronously(Action action) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
93 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
94 this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, action); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
95 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
96 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
97 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
98 /// Executes the specified <see cref="Action "/> at the <see cref="DispatcherPriority.ApplicationIdle"/> priority |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
99 /// on the thread on which the DispatcherObject is associated with. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
100 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
101 /// <param name="dispatcherObject">The dispatcher object.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
102 /// <param name="action">The action.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
103 protected void InvokeAsynchronouslyInBackground(Action action) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
104 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
105 this.Dispatcher.BeginInvoke(DispatcherPriority.Background, action); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
106 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
107 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
108 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
109 /// Executes the specified <see cref="Action "/> at the <see cref="DispatcherPriority.ApplicationIdle"/> priority |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
110 /// on the thread on which the DispatcherObject is associated with. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
111 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
112 /// <param name="dispatcherObject">The dispatcher object.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
113 /// <param name="action">The action.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
114 protected void Invoke(Action action) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
115 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
116 if (this.Dispatcher.CheckAccess()) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
117 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
118 action.Invoke(); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
119 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
120 else |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
121 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
122 this.Dispatcher.Invoke(action); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
123 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
124 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
125 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
126 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
127 /// Notifies all properties changed. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
128 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
129 protected void NotifyAllPropertiesChanged() |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
130 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
131 this.NotifyPropertyChanged((string)null); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
132 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
133 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
134 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
135 /// Notifies the property changed. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
136 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
137 /// <typeparam name="T"></typeparam> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
138 /// <param name="property">The property.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
139 protected virtual void NotifyPropertyChanged<T>(Expression<Func<T>> property) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
140 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
141 this.NotifyPropertyChanged(property.CreateChangeEventArgs()); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
142 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
143 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
144 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
145 /// Notifies the property changed. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
146 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
147 /// <param name="propertyName">Name of the property.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
148 protected virtual void NotifyPropertyChanged(string propertyName) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
149 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
150 this.NotifyPropertyChanged(new PropertyChangedEventArgs(propertyName)); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
151 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
152 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
153 /// <summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
154 /// Notifies the property changed. |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
155 /// </summary> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
156 /// <param name="propertyName">Name of the property.</param> |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
157 protected virtual void NotifyPropertyChanged(PropertyChangedEventArgs args) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
158 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
159 if (this.PropertyChanged != null) |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
160 { |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
161 this.PropertyChanged(this, args); |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
162 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
163 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
164 |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
165 #endregion |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
166 } |
443821e55f06
Initial cleaned up add from Codeplex files
stevenh7776 stevenhollidge@hotmail.com
parents:
diff
changeset
|
167 } |