3 using System.ComponentModel;
25 [Conditional(
"DEBUG")]
31 if (propertyName !=
string.Empty && TypeDescriptor.GetProperties(
this)[propertyName] == null)
33 string msg =
"Invalid property name: " + propertyName;
35 if (this.ThrowOnInvalidPropertyName)
36 throw new Exception(msg);
48 protected virtual bool ThrowOnInvalidPropertyName {
get;
private set; }
61 this.VerifyPropertyName(propertyName);
63 PropertyChangedEventHandler handler = this.PropertyChanged;
66 var e =
new PropertyChangedEventArgs(propertyName);
92 string msg =
string.Format(
"{0} ({1}) Finalized", this.GetType().Name, this.GetHashCode());
93 System.Diagnostics.Debug.WriteLine(msg);
void VerifyPropertyName(string propertyName)
Warns the developer if this object does not have a public property with the specified name...
virtual void OnDispose()
Child classes can override this method to perform clean-up logic, such as removing event handlers...
void Dispose()
Invoked when this object is being removed from the application and will be subject to garbage collect...
Class representing messenger for communicating between viewmodels.
ViewModelBase()
Create viewmodel base.
PropertyChangedEventHandler PropertyChanged
Raised when a property on this object has a new value.
Messenger messenger
Instance of messenger for communicating between view models.
virtual void OnPropertyChanged(string propertyName)
Raises this object's PropertyChanged event.