Created
February 26, 2014 00:08
-
-
Save JohanLarsson/9220700 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Machine : INotifyPropertyChanged | |
| { | |
| private Tool _tool; | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| public event EventHandler<ToolChangedEventArgs> ToolChanged; | |
| public Tool Tool | |
| { | |
| get { return _tool; } | |
| set | |
| { | |
| if (Equals(value, _tool)) | |
| { | |
| return; | |
| } | |
| _tool = value; | |
| OnPropertyChanged(); | |
| } | |
| } | |
| protected virtual void OnToolChanged(ToolChangedEventArgs e) | |
| { | |
| var handler = ToolChanged; | |
| if (handler != null) | |
| { | |
| handler(this, e); | |
| } | |
| } | |
| [NotifyPropertyChangedInvocator] | |
| protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) | |
| { | |
| var handler = PropertyChanged; | |
| if (handler != null) | |
| { | |
| handler(this, new PropertyChangedEventArgs(propertyName)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment