-
Notifications
You must be signed in to change notification settings - Fork 0
/
CalibrateWindow.xaml.cs
156 lines (139 loc) · 4.5 KB
/
CalibrateWindow.xaml.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace TouchWall
{
/// <summary>
/// Interaction logic for CalibrateWindow.xaml
/// </summary>
public partial class CalibrateWindow : Window
{
private static MainWindow _parentMainWindow;
private CalibrateWindow(MainWindow mainWindow)
{
_parentMainWindow = mainWindow;
InitializeComponent();
UpdateLabels();
}
private static CalibrateWindow _instance;
public static CalibrateWindow OpenCalibrateWindow(MainWindow mainWindow)
{
if (_instance == null)
{
_instance = new CalibrateWindow(mainWindow);
}
return _instance;
}
/// <summary>
/// Called when the Close button in the top right is pressed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void WindowClosing(object sender, CancelEventArgs e)
{
_instance = null;
}
private void UpdateLabels()
{
WallTopLabel.Content = Screen.TopEdge.ToString("0.00") + "m";
WallLeftLabel.Content = Screen.LeftEdge.ToString("0.00") + "m";
WallRightLabel.Content = Screen.RightEdge.ToString("0.00") + "m";
WallBottomLabel.Content = Screen.BottomEdge.ToString("0.00") + "m";
}
/// <summary>
/// Handles the event where the user clicks on WallTopUp
/// </summary>
private void WallTop_ClickUp(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.TopEdge += 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallTopDown
/// </summary>
private void WallTop_ClickDown(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.TopEdge -= 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallLeftLeft
/// </summary>
private void WallLeft_ClickLeft(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.LeftEdge -= 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallLeftRight
/// </summary>
private void WallLeft_ClickRight(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.LeftEdge += 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallRightLeft
/// </summary>
private void WallRight_ClickLeft(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.RightEdge -= 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallRightRight
/// </summary>
private void WallRight_ClickRight(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.RightEdge += 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallBottomUp
/// </summary>
private void WallBottom_ClickUp(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.BottomEdge += 0.01f;
}
UpdateLabels();
}
/// <summary>
/// Handles the event where the user clicks on WallBottomDown
/// </summary>
private void WallBottom_ClickDown(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
Screen.BottomEdge -= 0.01f;
}
UpdateLabels();
}
private void FullCalibration(object sender, RoutedEventArgs e)
{
if (TouchWallApp.KinectSensor.IsAvailable)
{
_parentMainWindow.CalibrateClick();
}
}
}
}