Skip to content

Instantly share code, notes, and snippets.

@devjaime
Created April 17, 2019 04:40
Show Gist options
  • Select an option

  • Save devjaime/bd5aac6def0a647dada45cd9926cbe4e to your computer and use it in GitHub Desktop.

Select an option

Save devjaime/bd5aac6def0a647dada45cd9926cbe4e to your computer and use it in GitHub Desktop.
BaseViewModel.cs
using System;
using System.Threading.Tasks;
namespace Acelerometro.ViewModel
{
public class BaseViewModel : ObservableObject
{
bool isBusy;
public bool IsBusy
{
get => isBusy;
set => SetProperty(ref isBusy, value, onChanged: () => OnPropertyChanged(nameof(IsNotBusy)));
}
public bool IsNotBusy => !IsBusy;
public virtual void OnAppearing()
{
}
public virtual void OnDisappearing()
{
}
internal event Func<string, Task> DoDisplayAlert;
public Task DisplayAlertAsync(string message)
{
return DoDisplayAlert?.Invoke(message) ?? Task.CompletedTask;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment