-
Notifications
You must be signed in to change notification settings - Fork 0
/
GardenSettingsPage.xaml
347 lines (335 loc) · 37.4 KB
/
GardenSettingsPage.xaml
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GardenManagement"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Converters="using:WinRTXamlToolkit.Converters"
x:Class="GardenManagement.GardenSettingsPage"
mc:Ignorable="d">
<Page.Resources>
<Converters:MultiplyConverter x:Key="MultiplyConverter"/>
</Page.Resources>
<RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<CommandBar x:Name="cbar_Top" OverflowButtonVisibility="Collapsed" DefaultLabelPosition="Right" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" >
<CommandBar.Content>
<TextBlock Text="Garden settings" Height="{Binding ElementName=cbar_Top, Path=ActualHeight}" Margin="3,0" FontSize="30" ></TextBlock>
</CommandBar.Content>
<AppBarButton x:Name="AppBarHome" Icon="Home" Label="Home" Click="AppBarHome_Click" />
<AppBarButton x:Name="AppBarGardenSettings" Icon="Globe" Label="Garden Settings" Click="AppBarGardenSettings_Click" />
<AppBarButton x:Name="AppBarGeneralSettings" Icon="Setting" Label="General Settings" Click="AppBarGeneralSettings_Click"/>
</CommandBar>
<Pivot x:Name="piv_Settings" RelativePanel.Below="cbar_Top" Loaded="piv_Settings_Loaded" >
<PivotItem x:Name="pitem_SensorType" >
<PivotItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Sensor Types"></TextBlock>
<Button Background="Transparent" x:Name="btn_HelpSensorTyp">
<SymbolIcon Symbol="Help"></SymbolIcon>
<Button.Flyout>
<Flyout Placement="Bottom" >
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<StackPanel >
<TextBlock Text="Sensor Types" Margin="3" FontWeight="Bold" TextDecorations="Underline"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Within the "Sensor Types" section of the settings, you define the sensor types used in your garden."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="The following information is defined as mandatory:"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Sensor type name"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Give your sensor type a descriptive name."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Reading method"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="The reading method needs to be selected out of the methods stored in the "SensorsHelper" class in the "Electronics" namespace. In case you have two sensors of the same physical type which have different reading methods (e.g. because one is behind a port extender and the other one is not), you need to define two different sensor types. If you have one physical sensor that serves multi purposes (e.g. a DHT11 which reads both temperature and humidity), you can define this as one sensor type."></TextBlock>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</PivotItem.Header>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<RelativePanel HorizontalAlignment="Stretch">
<TextBlock x:Name="tbl_SensorTypeExplanation" Text="Please select a Sensor type or press "+"" Margin="0,3,0,3"></TextBlock>
<ComboBox x:Name="cbox_SelectedSensorType" RelativePanel.Below="tbl_SensorTypeExplanation" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.LeftOf="btn_NewSensorType" Margin="0,3,0,3" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorTypeName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button x:Name="btn_NewSensorType" RelativePanel.Below="tbl_SensorTypeExplanation" RelativePanel.AlignRightWithPanel="True" Click="btn_NewSensorType_Click" Margin="3,3,0,3" >
<SymbolIcon Symbol="Add"></SymbolIcon>
</Button>
<TextBox x:Name="tbx_SensorTypeDescription" Header="Please enter a description of this Sensor Type" DataContext="{Binding ElementName=cbox_SelectedSensorType, Path=SelectedItem}" Text="{Binding SensorTypeName,Mode=TwoWay}" RelativePanel.Below="cbox_SelectedSensorType" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsEnabled="{Binding ElementName=cbox_SelectedSensorType, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></TextBox>
<ComboBox x:Name="cbox_SensorTypeReadingMethod" RelativePanel.Below="tbx_SensorTypeDescription" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalAlignment="Stretch" Header="Please select a reading Method for this sensor type" SelectedItem="{Binding ElementName=cbox_SelectedSensorType, Path=SelectedItem.HowToRead, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding ElementName=cbox_SelectedSensorType, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<RelativePanel RelativePanel.Below="cbox_SensorTypeReadingMethod" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<Button RelativePanel.LeftOf="btn_SensorTypeCancel" Margin="0,0,3,0" x:Name="btn_SensorTypeSave" Click="btn_SensorTypeSave_Click" IsEnabled="{Binding ElementName=cbox_SelectedSensorType, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" >
<SymbolIcon Symbol="Save"></SymbolIcon>
</Button>
<Button RelativePanel.AlignRightWithPanel="True" x:Name="btn_SensorTypeCancel" Click="btn_SensorTypeCancel_Click" IsEnabled="{Binding ElementName=cbox_SelectedSensorType, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Cancel"></SymbolIcon>
</Button>
</RelativePanel>
</RelativePanel>
</ScrollViewer>
</PivotItem>
<PivotItem x:Name="pitem_Garden" >
<PivotItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Garden"></TextBlock>
<Button Background="Transparent" x:Name="btn_HelpGarden">
<SymbolIcon Symbol="Help"></SymbolIcon>
<Button.Flyout>
<Flyout Placement="Bottom" >
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<StackPanel >
<TextBlock Text="Garden" Margin="3" FontWeight="Bold" TextDecorations="Underline"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Within the "Garden" section of the settings, you define the gardens you want to manage with this application. You need to do this before setting up your sensors and plants."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="The following information is defined as mandatory:"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Garden name"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Give your garden a descriptive name."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Garden size (number of rows & columns)"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Within this application, the plants in a garden are positioned within a table. Therefore, you need to give the size of your garden in rows and columns. Not all positions have to be filled with a plant."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text=" The following information is defined as optional:"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Relevant sensors"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="There are three types of sensors that are considered as relevant for the overall garden: watertank, temperature & humidity. In case you want to use these sensors, please save your garden without them, then go to the "Sensor" section of the settings, define the sensors and come back here in order to assign the sensors as the overall sensors of this garden."></TextBlock>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</PivotItem.Header>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<RelativePanel HorizontalAlignment="Stretch">
<TextBlock x:Name="tbl_GardenExplanation" Text="Please Select a Garden or press "+"" Margin="0,3,0,3"></TextBlock>
<ComboBox x:Name="cbox_SelectedGarden" RelativePanel.Below="tbl_GardenExplanation" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.LeftOf="btn_NewGarden" Margin="0,3,3,3" >
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding GardenName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button x:Name="btn_NewGarden" RelativePanel.Below="tbl_GardenExplanation" RelativePanel.AlignRightWithPanel="True" Click="btn_NewGarden_Click" Margin="0,3,0,3">
<SymbolIcon Symbol="Add"></SymbolIcon>
</Button>
<TextBox x:Name="tbx_GardenName" Header="Please enter a name for your Garden" RelativePanel.Below="cbox_SelectedGarden" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" DataContext="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem}" Text="{Binding GardenName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></TextBox>
<Slider RelativePanel.Below="tbx_GardenName" Minimum="1" Maximum="10" x:Name="slid_GardenRows" Header="How many rows does your garden contain?" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignLeftWithPanel="True" DataContext="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem}" Value="{Binding NumberOfRows, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></Slider>
<Slider x:Name="slid_GardenColumns" RelativePanel.Below="slid_GardenRows" Minimum="1" Maximum="10" Header="How many Columns does your garden contain?" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" DataContext="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem}" Value="{Binding NumberOfColumns, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></Slider>
<ComboBox x:Name="cbox_GardenWatertankSensor" RelativePanel.Below="slid_GardenColumns" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" ItemsSource="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem.Sensors, Mode=OneWay}" SelectedItem="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem.WatertankSensor, Mode=TwoWay, UpdateSourceTrigger=Explicit}" Header="Please select a watertank sensor" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox x:Name="cbox_GardenTemperatureSensor" RelativePanel.Below="cbox_GardenWatertankSensor" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Header="Please select a temperature sensor" ItemsSource="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem.Sensors, Mode=OneWay}" SelectedItem="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem.TemperatureSensor, Mode=TwoWay, UpdateSourceTrigger=Explicit}" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox x:Name="cbox_GardenAirHumiditySensor" RelativePanel.Below="cbox_GardenTemperatureSensor" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Header="Please select an air humidity sensor" ItemsSource="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem.Sensors, Mode=OneWay}" SelectedItem="{Binding ElementName=cbox_SelectedGarden, Path=SelectedItem.AirHumiditySensor, Mode=TwoWay, UpdateSourceTrigger=Explicit}" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<RelativePanel RelativePanel.Below="cbox_GardenAirHumiditySensor" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<Button RelativePanel.LeftOf="btn_GardenCancel" x:Name="btn_GardenSave" Click="btn_GardenSave_Click" Margin="0,0,3,0" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Save"></SymbolIcon>
</Button>
<Button RelativePanel.AlignRightWithPanel="True" x:Name="btn_GardenCancel" Click="btn_GardenCancel_Click" IsEnabled="{Binding ElementName=cbox_SelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Cancel"></SymbolIcon>
</Button>
</RelativePanel>
</RelativePanel>
</ScrollViewer>
</PivotItem>
<PivotItem x:Name="pitem_Sensor">
<PivotItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Sensor"></TextBlock>
<Button Background="Transparent" x:Name="btn_HelpSensor">
<SymbolIcon Symbol="Help"></SymbolIcon>
<Button.Flyout>
<Flyout Placement="Bottom" >
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<StackPanel >
<TextBlock Text="Sensor" Margin="3" FontWeight="Bold" TextDecorations="Underline"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Within the "Sensor" section of the settings, you define the sensors you use in your gardens."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="In order to do so, you need to first select the garden, for which you want to define sensors. If you have a physical sensor you want to use in multiple gardens, please maintain it twice in here. The following information is defined as mandatory:"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Sensor name"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Give your sensor a descriptive name."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Reading timeframe (in seconds)"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="This value decides, how often your sensor will be read by the application."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Sensor Type"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Please select the type of your sensor as defined in the "Sensor Types" section of the settings. If your sensor type guides to a reading method that accepts / needs parameters, you will be prompted to give the values for these parameters."></TextBlock>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</PivotItem.Header>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<RelativePanel HorizontalAlignment="Stretch">
<ComboBox x:Name="cbox_SensorSelectedGarden" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" ItemsSource="{Binding ItemsSource, ElementName=cbox_SelectedGarden}" SelectedItem="{Binding SelectedItem, ElementName=cbox_SelectedGarden, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,3,0,3" >
<ComboBox.Header>
<TextBlock Text="Please select a garden:"></TextBlock>
</ComboBox.Header>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding GardenName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock x:Name="tbl_SensorExplanation" Text="Please select a Sensor or press "+"" RelativePanel.Below="cbox_SensorSelectedGarden" Margin="0,3,0,3"></TextBlock>
<ComboBox x:Name="cbox_SelectedSensor" RelativePanel.Below="tbl_SensorExplanation" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.LeftOf="btn_NewSensor" IsEnabled="{Binding ElementName=cbox_SensorSelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" ItemsSource="{Binding ElementName=cbox_SensorSelectedGarden, Path=SelectedItem.Sensors, Mode=OneWay}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button x:Name="btn_NewSensor" RelativePanel.Below="tbl_SensorExplanation" RelativePanel.AlignRightWithPanel="True" Click="btn_NewSensor_Click" IsEnabled="{Binding ElementName=cbox_SensorSelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="3,3,0,3">
<SymbolIcon Symbol="Add"></SymbolIcon>
</Button>
<TextBox x:Name="tbx_SensorSensorName" DataContext="{Binding ElementName=cbox_SelectedSensor, Path=SelectedItem}" Text="{Binding SensorName, Mode=TwoWay}" Header="Please enter a name for this Sensor" RelativePanel.Below="cbox_SelectedSensor" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsEnabled="{Binding ElementName=cbox_SelectedSensor, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></TextBox>
<TextBox x:Name="tbx_SensorReadingTimeframe" DataContext="{Binding ElementName=cbox_SelectedSensor, Path=SelectedItem}" Text="{Binding ReadingTimeframe, Mode=TwoWay}" Header="Please enter the reading timeframe (in seconds) for this Sensor" RelativePanel.Below="tbx_SensorSensorName" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsEnabled="{Binding ElementName=cbox_SelectedSensor, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></TextBox>
<ComboBox x:Name="cbox_SensorSensorType" SelectedItem="{Binding ElementName=cbox_SelectedSensor, Path=SelectedItem.SensorType, Mode=TwoWay}" Header="Please select the Sensor Type" RelativePanel.Below="tbx_SensorReadingTimeframe" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalAlignment="Stretch" SelectionChanged="cbox_SensorSensorType_SelectionChanged" IsEnabled="{Binding ElementName=cbox_SelectedSensor, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorTypeName}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ListView x:Name="lview_PlantSensorParameters" RelativePanel.Below="cbox_SensorSensorType" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsEnabled="{Binding ElementName=cbox_SelectedSensor, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<TextBox Header="{Binding ParameterName}" Text="{Binding ParameterString, Mode=TwoWay}"></TextBox>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<RelativePanel RelativePanel.Below="lview_PlantSensorParameters" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<Button x:Name="btn_SensorSave" RelativePanel.LeftOf="btn_SensorCanel" Click="btn_SensorSave_Click" Margin="0,0,3,0" IsEnabled="{Binding ElementName=cbox_SelectedSensor, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Save"></SymbolIcon>
</Button>
<Button x:Name="btn_SensorCanel" RelativePanel.AlignRightWithPanel="True" Click="btn_SensorCanel_Click" IsEnabled="{Binding ElementName=cbox_SelectedSensor, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Cancel"></SymbolIcon>
</Button>
</RelativePanel>
</RelativePanel>
</ScrollViewer>
</PivotItem>
<PivotItem x:Name="pitem_Plants">
<PivotItem.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Plants"></TextBlock>
<Button Background="Transparent" x:Name="btn_HelpPlants">
<SymbolIcon Symbol="Help"></SymbolIcon>
<Button.Flyout>
<Flyout Placement="Right" >
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"></Setter>
</Style>
</Flyout.FlyoutPresenterStyle>
<StackPanel >
<TextBlock Text="Plants" Margin="3" FontWeight="Bold" TextDecorations="Underline"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Within the "Plants" section of the settings, you can define the plants that you actually planted in your garden."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="In order to do so, you need to first define a garden in the "Garden" section of the settings."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Within this page, you first need to select the garden you want to work on. Aftwerwards, you can select the position of the plant and give the needed information. The following information is defined as mandatory:"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Plant Name"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="Give your plant a descriptive name (e.g. name it by the type of the plant)"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Watering Threshold"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="The watering threshold is defined as a percentage value. If the soil moisture measured by the given soil moisture sensor falls under this value, the plant will be watered."></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" TextDecorations="Underline" Text="Soil moisture sensor"></TextBlock>
<TextBlock Margin="3" TextWrapping="Wrap" Text="You need to select the soil moisture sensor that is relevant for this plant. This sensor needs to be defined in the "Sensor" section of the settings first. The data from this sensor in combination with the defined watering threshold decides whether the plant needs to be watered or not."></TextBlock>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</PivotItem.Header>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<RelativePanel>
<ComboBox x:Name="cbox_PlantSelectedGarden" HorizontalAlignment="Stretch" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" ItemsSource="{Binding ItemsSource, ElementName=cbox_SelectedGarden}" SelectedItem="{Binding SelectedItem, ElementName=cbox_SelectedGarden, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0,3,0,3">
<ComboBox.Header>
<TextBlock Text="Please select a garden:"></TextBlock>
</ComboBox.Header>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding GardenName}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<GridView x:Name="grid_Plants" RelativePanel.Below="cbox_PlantSelectedGarden" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" SizeChanged="grid_Plants_SizeChanged" ItemsSource="{Binding SelectedItem.Plants, ElementName=cbox_PlantSelectedGarden, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding ElementName=cbox_PlantSelectedGarden, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem" x:Name="stl_grid_Plants">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Margin" Value="0,0,0,0" />
</Style>
</GridView.ItemContainerStyle>
<GridView.Header>
<TextBlock Text="Please select the Plant to edit:"></TextBlock>
</GridView.Header>
<GridView.ItemTemplate >
<DataTemplate>
<TextBlock x:Name="tbl_GridPlantsPlantName" Text="{Binding PlantName}" />
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
<TextBox x:Name="tbx_PlantsPlantName" DataContext="{Binding ElementName=grid_Plants, Path=SelectedItem}" Text="{Binding PlantName, Mode=TwoWay}" Header="Please enter a name for this Plant" RelativePanel.Below="grid_Plants" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></TextBox>
<TextBox x:Name="tbx_PlantsLocationRow" Text="{Binding LocationRow}" DataContext="{Binding ElementName=grid_Plants, Path=SelectedItem}" Header="Row" IsEnabled="False" RelativePanel.Below="tbx_PlantsPlantName" Margin="0,3,3,3"></TextBox>
<TextBox x:Name="tbx_PlantsLocationColumn" Text="{Binding LocationColumn}" DataContext="{Binding ElementName=grid_Plants, Path=SelectedItem}" Header="Column" IsEnabled="False" RelativePanel.Below="tbx_PlantsPlantName" RelativePanel.RightOf="tbx_PlantsLocationRow" Margin="3,3,0,3"></TextBox>
<Slider x:Name="slid_PlantsWateringThreshold" Header="Please enter the watering threshold (in percent)" DataContext="{Binding ElementName=grid_Plants, Path=SelectedItem}" Value="{Binding WateringThreshold, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" RelativePanel.Below="tbx_PlantsLocationRow" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3"></Slider>
<ComboBox x:Name="cbox_PlantsRelevantSoilSensor" Header="Please select, which soil moisture sensor is relevant for this plant" RelativePanel.Below="slid_PlantsWateringThreshold" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalAlignment="Stretch" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" ItemsSource="{Binding ElementName=cbox_PlantSelectedGarden, Path=SelectedItem.Sensors, Mode=OneWay}" SelectedItem="{Binding ElementName=grid_Plants, Path=SelectedItem.RelevantSoilMoistureSensor}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorName}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox x:Name="cbox_PlantWateringMethod" SelectedItem="{Binding ElementName=grid_Plants, Path=SelectedItem.HowToWater, Mode=TwoWay}" Header="Please select the Watering Method for this plant" RelativePanel.Below="cbox_PlantsRelevantSoilSensor" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalAlignment="Stretch" SelectionChanged="cbox_PlantWateringMethod_SelectionChanged" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,3">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"></TextBlock>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ListView x:Name="lview_PlantWateringParameters" RelativePanel.Below="cbox_PlantWateringMethod" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" ItemsSource="{Binding ElementName=grid_Plants, Path=SelectedItem.Parameters, Mode=TwoWay}" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}" Margin="0,3,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<TextBox Header="{Binding ParameterName}" Text="{Binding ParameterString, Mode=TwoWay}"></TextBox>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<RelativePanel RelativePanel.Below="lview_PlantWateringParameters" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<Button x:Name="btn_PlantSave" RelativePanel.LeftOf="btn_PlantCancel" Click="btn_PlantSave_Click" Margin="0,0,3,0" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Save"></SymbolIcon>
</Button>
<Button x:Name="btn_PlantCancel" RelativePanel.AlignRightWithPanel="True" Click="btn_PlantCancel_Click" IsEnabled="{Binding ElementName=grid_Plants, Path=SelectedIndex, Converter={StaticResource SelectedItemToBoolConverter}}">
<SymbolIcon Symbol="Cancel"></SymbolIcon>
</Button>
</RelativePanel>
</RelativePanel>
</ScrollViewer>
</PivotItem>
</Pivot>
</RelativePanel>
</Page>