-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMainPage.xaml
432 lines (429 loc) · 27.8 KB
/
MainPage.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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<Page
x:Class="WindowsPushSample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WindowsPushSample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<local:InverseBooleanConverter x:Name="inverseBooleanConverter" />
<ControlTemplate x:Key="ButtonControlTemplate1" TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="#112C3D4F" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="#B22C3D4F" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="#FF2C3D4F" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="#192C3D4F" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Border"
Storyboard.TargetProperty="Opacity"
To="0.5"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="3">
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<Rectangle x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5" />
<Rectangle x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5" />
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="TextBoxControlTemplate1" TargetType="TextBox">
<Grid>
<Grid.Resources>
<Style x:Name="DeleteButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPointerOverForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPressedBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPressedBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="GlyphElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxButtonPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="BorderElement"
BorderBrush="{StaticResource TextBoxButtonBorderThemeBrush}"
BorderThickness="{TemplateBinding BorderThickness}"/>
<Border x:Name="BackgroundElement"
Background="{StaticResource TextBoxButtonBackgroundThemeBrush}"
Margin="{TemplateBinding BorderThickness}">
<TextBlock x:Name="GlyphElement"
Foreground="{StaticResource TextBoxButtonForegroundThemeBrush}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Text=""
FontFamily="{StaticResource SymbolThemeFontFamily}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="Opacity"
To="0.2" Duration="0" />
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity"
To="0.2" Duration="0" />
<!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentElement"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TextBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>-->
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="{StaticResource TextControlBackgroundThemeOpacity}" />
<DoubleAnimation Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="{StaticResource TextControlBorderThemeOpacity}" />
</Storyboard>
</VisualState>
<VisualState x:Name="PointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BackgroundElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="{StaticResource TextControlPointerOverBackgroundThemeOpacity}" />
<DoubleAnimation Storyboard.TargetName="BorderElement"
Storyboard.TargetProperty="Opacity"
Duration="0"
To="{StaticResource TextControlPointerOverBorderThemeOpacity}" />
</Storyboard>
</VisualState>
<VisualState x:Name="Focused" />
</VisualStateGroup>
<VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="ButtonCollapsed" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border x:Name="BackgroundElement"
Background="{TemplateBinding Background}"
Margin="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="2"/>
<Border x:Name="BorderElement"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Grid.ColumnSpan="2"/>
<ScrollViewer x:Name="ContentElement"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
ZoomMode="Disabled" />
<Button x:Name="DeleteButton"
Style="{StaticResource DeleteButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}"
IsTabStop="False"
Grid.Column="1"
Visibility="Collapsed"
FontSize="{TemplateBinding FontSize}"
VerticalAlignment="Stretch"/>
</Grid>
</ControlTemplate>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="Foreground" Value="#FF2C3D4F" />
<Setter Property="BorderBrush" Value="#FF2C3D4F" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontFamily" Value="Open-Sans" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Template" Value="{StaticResource ButtonControlTemplate1}" />
</Style>
<Style x:Key="textBoxStyle" TargetType="TextBox">
<Setter Property="Foreground" Value="#FF2C3D4F" />
<Setter Property="BorderBrush" Value="#FFDBE3E4" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="35" />
<Setter Property="Template" Value="{StaticResource TextBoxControlTemplate1}" />
</Style>
<Style x:Key="textBlockStyleBold" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="#FF2C3D4F" />
<Setter Property="Margin" Value="3, 0, 0, 0" />
</Style>
<Style x:Key="textBlockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="13" />
<Setter Property="Foreground" Value="#FF2C3D4F" />
<Setter Property="FontFamily" Value="Open-Sans" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Margin" Value="3, 7, 0, 7" />
<Setter Property="Padding" Value="3" />
</Style>
</Page.Resources>
<Grid Background="White" Width="1280" Height="900"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="150" />
<RowDefinition Height="40" />
<RowDefinition Height="120" />
<RowDefinition Height="40" />
<RowDefinition Height="70" />
<RowDefinition Height="20" />
<RowDefinition Height="270" />
<RowDefinition Height="150" />
</Grid.RowDefinitions>
<!--header row-->
<StackPanel Grid.Row="0" Orientation="Horizontal" Background="#2D3F51">
<Image x:Name="headerLogo" Source="Assets/logo24x24.png" Margin="20, 0, 0, 0" Height="24" Width="24"/>
<TextBlock Text="Windows Push Sample" Margin="10, 0, 0, 0" VerticalAlignment="Center" FontSize="14"/>
</StackPanel>
<!--Application Management region-->
<Border BorderBrush="#FFDBE3E4" BorderThickness="1" Width="800" Height="110" VerticalAlignment="Bottom"
Grid.Row="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2.9*" />
<ColumnDefinition Width="0.1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="30, 0, 0, 0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Application management" Grid.Row="0"
FontSize="20" Foreground="#FF2C3D4F"
FontFamily="Open-Sans" FontWeight="Light"/>
<TextBlock Text="You have to register your device before you can start sending push notifications."
Grid.Row="1" Margin="0, 5, 0, 0" TextWrapping="Wrap" LineHeight="18"
FontSize="13" Foreground="#B22C3D4F"/>
</Grid>
<Grid Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right"
Margin="5, 0, 30, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="Register" Click="OnRegisterClick"
Height="35" Padding="7, 0, 7, 0" Width="120"
Style="{StaticResource buttonStyle}"
IsEnabled="{Binding IsDeviceRegistered, Converter={StaticResource inverseBooleanConverter}}"/>
<Button Grid.Column="1" Content="Unregister" Click="OnUnregisterClick"
Height="35" Margin="2, 0, 0, 0"
Padding="7, 0, 7, 0" Width="120"
Style="{StaticResource buttonStyle}"
IsEnabled="{Binding IsDeviceRegistered}"/>
</Grid>
</Grid>
</Border>
<!--Toast message region-->
<StackPanel Grid.Row="3" Width="800" HorizontalAlignment="Center">
<TextBlock Text="Toast message:" Style="{StaticResource textBlockStyleBold}"/>
<TextBox x:Name="pushNotificationMessage"
Margin="3, 7, 0, 7" Padding="3"
HorizontalAlignment="Stretch"
Text="My first Windows Push Notification!"
Style="{StaticResource textBoxStyle}" IsEnabled="{Binding IsDeviceRegistered}"
/>
<Button Content="Send Push Notification" Click="OnSendClick" Margin="0, 10, 0, 0"
Width="170" Padding="5" Style="{StaticResource buttonStyle}" IsEnabled="{Binding IsDeviceRegistered}"
/>
</StackPanel>
<!--Second tile settings region-->
<StackPanel Grid.Row="5" Width="800" HorizontalAlignment="Center">
<TextBlock Text="Second Tile Settings" Style="{StaticResource textBlockStyleBold}"/>
<Grid Margin="0, 10, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" >
<Button Content="Pin Second Tile" Click="OnPinSecondTileClick"
Width="170" Style="{StaticResource buttonStyle}" IsEnabled="{Binding IsSecondaryTilePinned, Converter={StaticResource inverseBooleanConverter}}"/>
<Button Content="Register Second Tile" Click="OnRegisterSecondTileClick"
Width="170" Style="{StaticResource buttonStyle}" IsEnabled="{Binding ShowRegisterSecondTileButton}"
Margin="4, 0, 0, 0" />
</StackPanel>
<Button Content="Unpin Second Tile" Grid.Column="1" Click="OnUnpinSecondTileClick"
Width="170" Padding="5" Style="{StaticResource buttonStyle}"
HorizontalAlignment="Right" Template="{StaticResource ButtonControlTemplate1}"
IsEnabled="{Binding IsSecondaryTilePinned}"/>
</Grid>
</StackPanel>
<!--Second tile data region-->
<Grid Grid.Row="7" Width="800" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Image:" Grid.Column="0" Grid.Row="0" Style="{StaticResource textBlockStyle}"/>
<TextBox x:Name="image1" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch"
Style="{StaticResource textBoxStyle}" Text=".\Assets\logo150x150.png"
IsEnabled="{Binding IsSecondaryTileRegistered}"/>
<TextBlock Text="Text1:" Grid.Column="0" Grid.Row="1" Style="{StaticResource textBlockStyle}"/>
<TextBlock Text="Text2:" Grid.Column="0" Grid.Row="2" Style="{StaticResource textBlockStyle}"/>
<TextBlock Text="Text3:" Grid.Column="0" Grid.Row="3" Style="{StaticResource textBlockStyle}"/>
<TextBlock Text="Text4:" Grid.Column="0" Grid.Row="4" Style="{StaticResource textBlockStyle}"/>
<TextBox x:Name="text1" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch"
Style="{StaticResource textBoxStyle}"
Text="WindowsPushSample" IsEnabled="{Binding IsSecondaryTileRegistered}"/>
<TextBox x:Name="text2" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch"
Style="{StaticResource textBoxStyle}"
Text="Text2" IsEnabled="{Binding IsSecondaryTileRegistered}"/>
<TextBox x:Name="text3" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Stretch"
Style="{StaticResource textBoxStyle}"
Text="Text3" IsEnabled="{Binding IsSecondaryTileRegistered}"/>
<TextBox x:Name="text4" Grid.Column="1" Grid.Row="4" HorizontalAlignment="Stretch"
Style="{StaticResource textBoxStyle}"
Text="Text4" IsEnabled="{Binding IsSecondaryTileRegistered}"/>
<Button Content="Send Push Second Tile" Click="OnSendPushToSecondTileClick"
Margin="0, 10, 0, 0" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="5"
Width="170" Padding="5" HorizontalAlignment="Left" Style="{StaticResource buttonStyle}"
IsEnabled="{Binding IsSecondaryTileRegistered}"/>
</Grid>
<TextBlock x:Name="statusText" Grid.Row="8" Margin="10" FontSize="16" Padding="5"
VerticalAlignment="Bottom"/>
<Image x:Name="logo" Grid.Row="8"
Source="Assets/logo150x150.png"
Margin="0, 0, 10, 0"
VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="150" Height="150"/>
</Grid>
</Page>