-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewData.cs
134 lines (113 loc) · 3.98 KB
/
ViewData.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
using System.ComponentModel;
using System.Runtime.CompilerServices;
using ClassLibrary;
namespace Lab2Var2
{
public class ViewData : INotifyPropertyChanged
{
private string firstIntegral;
private string secondIntegral;
private string firstDerivatieve;
private string secondDerivatieve;
private string splineLeft;
private string splineRight;
public event PropertyChangedEventHandler PropertyChanged;
public ViewData()
{
InputChecker = new ErrorChecker(length: 20,
uniformLength: 40,
left: 0,
right: 40,
function: SPf.Random,
x1: 1,
x2: 10,
x3: 20);
InputChecker.DataChanged += OnInputDataChangedHandler;
var md = new MeasuredData(InputChecker.Length,
InputChecker.Left,
InputChecker.Right,
InputChecker.Function);
var sp = new SplineParameters(InputChecker.UniformLength,
InputChecker.X1,
InputChecker.X2,
InputChecker.X3);
SplinesData = new(md, sp);
}
public ChartData Chart { get; set; } = new ChartData();
public ErrorChecker InputChecker { get; set; }
public SplinesData SplinesData { get; set; }
public string FirstIntegral
{
get => firstIntegral;
set
{
firstIntegral = value;
OnPropertyChanged();
}
}
public string SecondIntegral
{
get => secondIntegral;
set
{
secondIntegral = value;
OnPropertyChanged();
}
}
public string FirstDerivatieve
{
get => firstDerivatieve;
set
{
firstDerivatieve = value;
OnPropertyChanged();
}
}
public string SecondDerivatieve
{
get => secondDerivatieve;
set
{
secondDerivatieve = value;
OnPropertyChanged();
}
}
public string SplineLeft
{
get => splineLeft;
set
{
splineLeft = value;
OnPropertyChanged();
}
}
public string SplineRight
{
get => splineRight;
set
{
splineRight = value;
OnPropertyChanged();
}
}
public void Update()
{
FirstIntegral = string.Empty;
SecondIntegral = string.Empty;
FirstDerivatieve = string.Empty;
SecondDerivatieve = string.Empty;
SplineLeft = string.Empty;
SplineRight = string.Empty;
SplinesData.Measured.Left = InputChecker.Left;
SplinesData.Measured.Right = InputChecker.Right;
SplinesData.Measured.Function = InputChecker.Function;
SplinesData.Measured.Length = InputChecker.Length;
SplinesData.SplineParameters.UniformLength = InputChecker.UniformLength;
SplinesData.SplineParameters.X1 = InputChecker.X1;
SplinesData.SplineParameters.X2 = InputChecker.X2;
SplinesData.SplineParameters.X3 = InputChecker.X3;
}
private void OnInputDataChangedHandler() => Update();
private void OnPropertyChanged([CallerMemberName] string propertyName = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}