WinData.cs
1.52 KB
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
using System.ComponentModel;
namespace OS.Spin.ViewModle.Models
{
public class WinData : INotifyPropertyChanged
{
//public event PropertyChangedEventHandler PropertyChanged;
//C#中私有变量默认都是下划线开头的
private int _runtimes; //私有
//public int _runtimesOne; //私有
public int runtimes
{
//获取值时将私有字段传出
get { return _runtimes; }
set
{
//赋值时将值传给私有字段
_runtimes = value;
OnPropertyChanged("runtimes");
//一旦执行了赋值操作说明其值被修改了,则立马通过
//INotifyPropertyChanged接口告诉UI(IntValue)被修改了
//PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("runtimes"));
}
}
//public int runtimesOne
//{
// get { return _runtimesOne; }
// set
// {
// _runtimesOne = value;
// //_runtimes = _runtimesOne;
// PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("runtimes"));
// }
//}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string strPropertyInfo)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(strPropertyInfo));
}
}
}
}