-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseNotifier.cs
50 lines (43 loc) · 1.54 KB
/
BaseNotifier.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
49
50
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation.Metadata;
namespace UniversalPlatformTools
{
/// <summary>
/// A Basic implementation of the <see cref="INotifyPropertyChanged"/> and <see cref="INotifyPropertyChanging"/> interfaces.
/// </summary>
[WebHostHidden]
public class BaseNotifier : INotifyPropertyChanged, INotifyPropertyChanging
{
public event PropertyChangedEventHandler PropertyChanged;
public event PropertyChangingEventHandler PropertyChanging;
protected virtual void NotifyPropertyChanged([CallerMemberName]string propertyName = "")
{
NotifyPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
protected virtual void NotifyPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(this, e);
}
protected virtual void NotifyPropertyChanging([CallerMemberName]string propertyName = "")
{
NotifyPropertyChanging(new PropertyChangingEventArgs(propertyName));
}
protected virtual void NotifyPropertyChanging(PropertyChangingEventArgs e)
{
PropertyChanging?.Invoke(this, e);
}
public BaseNotifier()
{
PropertyChanged += OnPropertyChanged;
}
protected virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
}
}
}