Guest User

Untitled

a guest
Dec 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System.ComponentModel;
  2. using System.Runtime.CompilerServices;
  3.  
  4. namespace VideoGameMusicApp.ViewModels
  5. {
  6. public class BaseViewModel : INotifyPropertyChanged
  7. {
  8. public event PropertyChangedEventHandler PropertyChanged;
  9.  
  10. protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
  11. {
  12. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  13. }
  14.  
  15. protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
  16. {
  17. if (object.Equals(storage, value)) return false;
  18. storage = value;
  19. OnPropertyChanged(propertyName);
  20. return true;
  21. }
  22.  
  23. private bool _isLoading = false;
  24.  
  25. public bool IsLoading
  26. {
  27. get => _isLoading;
  28. set => SetProperty(ref _isLoading, value);
  29. }
  30. }
  31. }
Add Comment
Please, Sign In to add comment