-
Notifications
You must be signed in to change notification settings - Fork 1
/
BaseViewModel.cs
executable file
·48 lines (42 loc) · 1.26 KB
/
BaseViewModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Threading.Tasks;
namespace Microsoft.MobCAT.MVVM
{
public abstract class BaseViewModel : BaseNotifyPropertyChanged, IDisposable
{
bool _isBusy;
/// <summary>
/// Gets or sets whether the ViewModel is busy.
/// </summary>
/// <value><c>true</c> if is busy; otherwise, <c>false</c>.</value>
public bool IsBusy
{
get
{
return _isBusy;
}
set
{
if (RaiseAndUpdate(ref _isBusy, value))
Raise(nameof(IsNotBusy));
}
}
/// <summary>
/// Gets a value indicating whether the ViewModel is not busy.
/// </summary>
/// <value><c>true</c> if is not busy; otherwise, <c>false</c>.</value>
public bool IsNotBusy => !IsBusy;
/// <summary>
/// Initialilzes the ViewModel.
/// </summary>
/// <returns>Task with result.</returns>
public virtual Task InitAsync() => Task.FromResult(true);
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) { }
}
}