Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created November 21, 2019 00:17
Show Gist options
  • Save icebeam7/37aa2a15cc7a8018e65af32dd26b3e3b to your computer and use it in GitHub Desktop.
Save icebeam7/37aa2a15cc7a8018e65af32dd26b3e3b to your computer and use it in GitHub Desktop.
DemoCamara: BaseViewModel.cs
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace DemoCamara.ViewModels
{
public class BaseViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (object.Equals(storage, value)) return false;
storage = value;
OnPropertyChanged(propertyName);
return true;
}
private bool _isBusy = false;
public bool IsBusy
{
get => _isBusy;
set => SetProperty(ref _isBusy, value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment