PropertyChangedBase.cs 587 B

123456789101112131415161718192021
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows;
  4. namespace PRSServer
  5. {
  6. public class PropertyChangedBase : INotifyPropertyChanged
  7. {
  8. public event PropertyChangedEventHandler PropertyChanged;
  9. protected virtual void OnPropertyChanged(string propertyName)
  10. {
  11. Application.Current.Dispatcher.BeginInvoke((Action)(() =>
  12. {
  13. var handler = PropertyChanged;
  14. if (handler != null)
  15. handler(this, new PropertyChangedEventArgs(propertyName));
  16. }));
  17. }
  18. }
  19. }