This repository was archived by the owner on May 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathAllSensorsPage.xaml
More file actions
206 lines (175 loc) · 11.2 KB
/
AllSensorsPage.xaml
File metadata and controls
206 lines (175 loc) · 11.2 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<views:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewmodels="clr-namespace:Samples.ViewModel"
xmlns:views="clr-namespace:Samples.View"
x:Class="Samples.View.AllSensorsPage"
Title="All Sensors">
<StackLayout>
<Label Text="Have a look at the accelerometer, compass, gyroscope and magnetometer." FontAttributes="Bold" Margin="12" />
<ScrollView>
<StackLayout Padding="12,0,12,12" Spacing="6">
<Label Text="Accelerometer" FontAttributes="Bold" Margin="0,6,0,0" />
<Grid x:Name="GridAccelerometer">
<Grid.BindingContext>
<viewmodels:AccelerometerViewModel />
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding X, StringFormat='X: {0:N}'}" />
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Y, StringFormat='Y: {0:N}'}" />
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Z, StringFormat='Z: {0:N}'}" />
<Picker Grid.Row="4" Grid.ColumnSpan="2" HorizontalOptions="FillAndExpand"
ItemsSource="{Binding Speeds}"
SelectedIndex="{Binding Speed, Mode=TwoWay}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="0" Text="Start" Command="{Binding StartCommand}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="1" Text="Stop" Command="{Binding StopCommand}"
IsEnabled="{Binding IsActive}" />
</Grid>
<Label Text="Compass" FontAttributes="Bold" Margin="0,6,0,0" />
<Grid x:Name="GridCompass">
<Grid.BindingContext>
<viewmodels:CompassViewModel />
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding Compass1, StringFormat='Compass 1 Degrees: {0:N}'}" />
<Picker Grid.Row="1" Grid.ColumnSpan="2" HorizontalOptions="FillAndExpand"
ItemsSource="{Binding Speeds}"
SelectedIndex="{Binding Speed1, Mode=TwoWay}"
IsEnabled="{Binding Compass1IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="2" Grid.Column="0" Text="Start" Command="{Binding StartCompass1Command}"
IsEnabled="{Binding Compass1IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="2" Grid.Column="1" Text="Stop" Command="{Binding StopCompass1Command}"
IsEnabled="{Binding Compass1IsActive}" />
</Grid>
<Label Text="Gyroscope" FontAttributes="Bold" Margin="0,6,0,0" />
<Grid x:Name="GridGyro">
<Grid.BindingContext>
<viewmodels:GyroscopeViewModel />
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding X, StringFormat='X: {0:N}'}" />
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Y, StringFormat='Y: {0:N}'}" />
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Z, StringFormat='Z: {0:N}'}" />
<Picker Grid.Row="4" Grid.ColumnSpan="2" HorizontalOptions="FillAndExpand"
ItemsSource="{Binding Speeds}"
SelectedIndex="{Binding Speed, Mode=TwoWay}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="0" Text="Start" Command="{Binding StartCommand}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="1" Text="Stop" Command="{Binding StopCommand}"
IsEnabled="{Binding IsActive}" />
</Grid>
<Label Text="Magnetometer" FontAttributes="Bold" Margin="0,6,0,0" />
<Grid x:Name="GridMagnetometer">
<Grid.BindingContext>
<viewmodels:MagnetometerViewModel />
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding X, StringFormat='X: {0:N}'}" />
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Y, StringFormat='Y: {0:N}'}" />
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Z, StringFormat='Z: {0:N}'}" />
<Picker Grid.Row="4" Grid.ColumnSpan="2" HorizontalOptions="FillAndExpand"
ItemsSource="{Binding Speeds}"
SelectedIndex="{Binding Speed, Mode=TwoWay}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="0" Text="Start" Command="{Binding StartCommand}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="1" Text="Stop" Command="{Binding StopCommand}"
IsEnabled="{Binding IsActive}" />
</Grid>
<Label Text="Orientation Sensor" FontAttributes="Bold" Margin="0,6,0,0" />
<Grid x:Name="GridOrientation">
<Grid.BindingContext>
<viewmodels:OrientationSensorViewModel />
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding X, StringFormat='X: {0:N}'}" />
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Y, StringFormat='Y: {0:N}'}" />
<Label Grid.Row="2" Grid.ColumnSpan="2" Text="{Binding Z, StringFormat='Z: {0:N}'}" />
<Label Grid.Row="3" Grid.ColumnSpan="2" Text="{Binding W, StringFormat='W: {0:N}'}" />
<Picker Grid.Row="4" Grid.ColumnSpan="2" HorizontalOptions="FillAndExpand"
ItemsSource="{Binding Speeds}"
SelectedIndex="{Binding Speed, Mode=TwoWay}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="0" Text="Start" Command="{Binding StartCommand}"
IsEnabled="{Binding IsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="5" Grid.Column="1" Text="Stop" Command="{Binding StopCommand}"
IsEnabled="{Binding IsActive}" />
</Grid>
<Label Text="Monitor barometer for changes." FontAttributes="Bold" Margin="12" />
<Grid x:Name="GridBarometer">
<Grid.BindingContext>
<viewmodels:BarometerViewModel />
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2"
Text="{Binding BaromterValue, StringFormat='Barometer pressure (hPA): {0:N}'}" />
<Button Grid.Row="1" Grid.Column="0" Text="Start" Command="{Binding StartBarometerComand}"
IsEnabled="{Binding BarometerIsActive, Converter={StaticResource NegativeConverter}}" />
<Button Grid.Row="1" Grid.Column="1" Text="Stop" Command="{Binding StopBarometerCommand}"
IsEnabled="{Binding BarometerIsActive}" />
</Grid>
</StackLayout>
</ScrollView>
</StackLayout>
</views:BasePage>