-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathMainWindowViewModel.cs
65 lines (50 loc) · 1.31 KB
/
MainWindowViewModel.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Windows.Input;
namespace FASandbox;
public class MainWindowViewModel : INotifyPropertyChanged
{
private double _min;
private double _max;
public MainWindowViewModel()
{
}
public Command Commands { get; } = new Command();
public event PropertyChangedEventHandler PropertyChanged;
public void Test(object param)
{
Debug.WriteLine("FIRED");
}
private bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName]string propName = "")
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
return true;
}
return false;
}
public double Min
{
get => _min;
set => RaiseAndSetIfChanged(ref _min, value);
}public double Max
{
get => _max;
set => RaiseAndSetIfChanged(ref _max, value);
}
}
public class Command : ICommand
{
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
Debug.WriteLine("FIRED");
}
}