-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
421 lines (390 loc) · 24.2 KB
/
Copy pathMainWindow.xaml
File metadata and controls
421 lines (390 loc) · 24.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
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
<Window x:Class="SwitchifyPc.App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="clr-namespace:SwitchifyPc.Core.Ui;assembly=SwitchifyPc.Core"
mc:Ignorable="d"
Title="Switchify PC"
MinHeight="520"
MinWidth="760"
Height="620"
Width="920"
Icon="Assets/icon.ico"
FontFamily="Segoe UI"
Background="#F5F4F7"
WindowStartupLocation="CenterScreen"
d:DataContext="{d:DesignInstance Type=ui:MainWindowViewModel, IsDesignTimeCreatable=True}">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<SolidColorBrush x:Key="BrandPrimary" Color="#D32F2F" />
<SolidColorBrush x:Key="BrandPrimaryHover" Color="#B3261E" />
<SolidColorBrush x:Key="Surface" Color="#FFFFFF" />
<SolidColorBrush x:Key="SurfaceMuted" Color="#F3F2F6" />
<SolidColorBrush x:Key="Text" Color="#1C1B1F" />
<SolidColorBrush x:Key="TextMuted" Color="#49454F" />
<SolidColorBrush x:Key="BorderColor" Color="#E2E0E8" />
<SolidColorBrush x:Key="StatusOk" Color="#2E7D32" />
<SolidColorBrush x:Key="StatusWarn" Color="#C49A2C" />
<SolidColorBrush x:Key="StatusError" Color="#BA1A1A" />
<SolidColorBrush x:Key="AccentContainer" Color="#FFDAD6" />
<SolidColorBrush x:Key="OnAccentContainer" Color="#410002" />
<Style TargetType="Button">
<Setter Property="MinHeight" Value="40" />
<Setter Property="Padding" Value="16,0" />
<Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="{StaticResource Surface}" />
<Setter Property="Foreground" Value="{StaticResource Text}" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Root"
MinHeight="{TemplateBinding MinHeight}"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Root" Property="BorderBrush" Value="{StaticResource BrandPrimary}" />
<Setter TargetName="Root" Property="Background" Value="{StaticResource SurfaceMuted}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Root" Property="Opacity" Value="0.55" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="PrimaryButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="BorderBrush" Value="{StaticResource BrandPrimary}" />
<Setter Property="Background" Value="{StaticResource BrandPrimary}" />
<Setter Property="Foreground" Value="White" />
</Style>
<Style x:Key="MainCard" TargetType="Border">
<Setter Property="Background" Value="{StaticResource Surface}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="16" />
<Setter Property="Padding" Value="32" />
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="42"
Direction="270"
Opacity="0.08"
ShadowDepth="8"
Color="#1C1B1F" />
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SubtlePanel" TargetType="Border">
<Setter Property="Background" Value="{StaticResource SurfaceMuted}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="10" />
<Setter Property="Padding" Value="12" />
</Style>
<Style x:Key="StatusPanel" TargetType="Border" BasedOn="{StaticResource SubtlePanel}">
<Style.Triggers>
<DataTrigger Binding="{Binding StatusTone}" Value="ready">
<Setter Property="BorderBrush" Value="#8BB88E" />
</DataTrigger>
<DataTrigger Binding="{Binding StatusTone}" Value="working">
<Setter Property="BorderBrush" Value="#D8C06B" />
</DataTrigger>
<DataTrigger Binding="{Binding StatusTone}" Value="error">
<Setter Property="BorderBrush" Value="#D08A8A" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="StatusBadge" TargetType="Border">
<Setter Property="Background" Value="{StaticResource Surface}" />
<Setter Property="BorderBrush" Value="{StaticResource BorderColor}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="999" />
<Setter Property="Padding" Value="12,7" />
</Style>
<Style x:Key="StatusDot" TargetType="Ellipse">
<Setter Property="Width" Value="9" />
<Setter Property="Height" Value="9" />
<Setter Property="Fill" Value="{StaticResource TextMuted}" />
<Style.Triggers>
<DataTrigger Binding="{Binding StatusBadgeTone}" Value="ready">
<Setter Property="Fill" Value="{StaticResource StatusOk}" />
</DataTrigger>
<DataTrigger Binding="{Binding StatusBadgeTone}" Value="connected">
<Setter Property="Fill" Value="{StaticResource StatusOk}" />
</DataTrigger>
<DataTrigger Binding="{Binding StatusBadgeTone}" Value="waiting">
<Setter Property="Fill" Value="{StaticResource StatusWarn}" />
</DataTrigger>
<DataTrigger Binding="{Binding StatusBadgeTone}" Value="error">
<Setter Property="Fill" Value="{StaticResource StatusError}" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="PrimaryStatusDot" TargetType="Ellipse">
<Setter Property="Width" Value="10" />
<Setter Property="Height" Value="10" />
<Setter Property="Fill" Value="{StaticResource StatusOk}" />
<Style.Triggers>
<DataTrigger Binding="{Binding StatusTone}" Value="working">
<Setter Property="Fill" Value="{StaticResource StatusWarn}" />
</DataTrigger>
<DataTrigger Binding="{Binding StatusTone}" Value="error">
<Setter Property="Fill" Value="{StaticResource StatusError}" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="DetailLabel" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextMuted}" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style x:Key="DetailValue" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource Text}" />
<Setter Property="FontSize" Value="13" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style x:Key="MutedText" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextMuted}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="LineHeight" Value="21" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style TargetType="ScrollBar">
<Setter Property="Width" Value="10" />
<Setter Property="MinWidth" Value="10" />
</Style>
</Window.Resources>
<Grid Background="#F5F4F7" Margin="24">
<Border HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Style="{StaticResource MainCard}">
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<StackPanel MinWidth="0">
<Grid Margin="0,0,0,30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="Desktop companion"
Foreground="{StaticResource TextMuted}"
FontSize="12"
FontWeight="Bold"
TextOptions.TextFormattingMode="Display" />
<TextBlock Margin="0,6,0,0"
Text="{Binding AppTitle}"
Foreground="{StaticResource Text}"
FontSize="30"
FontWeight="Bold" />
</StackPanel>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Top">
<Button Content="Settings"
Padding="16,0"
Click="OpenSettings_Click" />
<Border Margin="8,0,0,0"
Style="{StaticResource StatusBadge}">
<StackPanel Orientation="Horizontal">
<Ellipse Style="{StaticResource StatusDot}" />
<TextBlock Margin="8,0,0,0"
VerticalAlignment="Center"
Text="{Binding StatusBadgeLabel}"
Foreground="{StaticResource Text}"
FontSize="13"
FontWeight="Bold" />
</StackPanel>
</Border>
</StackPanel>
</Grid>
<Border Margin="0,0,0,16"
Style="{StaticResource StatusPanel}">
<StackPanel>
<TextBlock Text="{Binding StatusTitle}"
TextAlignment="Center"
Foreground="{StaticResource Text}"
FontSize="23"
FontWeight="Bold"
TextWrapping="Wrap" />
<TextBlock Margin="0,12,0,0"
Text="{Binding StatusBody}"
TextAlignment="Center"
Style="{StaticResource MutedText}" />
<Border Margin="0,18,0,0"
MinHeight="56"
Style="{StaticResource SubtlePanel}">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<Ellipse VerticalAlignment="Center"
Style="{StaticResource PrimaryStatusDot}" />
<TextBlock Margin="10,0,0,0"
VerticalAlignment="Center"
Text="{Binding BluetoothStatus}"
Foreground="{StaticResource Text}"
FontSize="14"
FontWeight="Bold" />
</StackPanel>
</Border>
<Border Margin="0,14,0,0"
Padding="14,12"
HorizontalAlignment="Center"
MinWidth="280"
Style="{StaticResource SubtlePanel}"
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel>
<TextBlock Text="Device connected"
TextAlignment="Center"
Foreground="{StaticResource Text}"
FontSize="14"
FontWeight="Bold" />
<TextBlock Margin="0,4,0,0"
Text="{Binding ConnectedDeviceSummary}"
TextAlignment="Center"
Style="{StaticResource MutedText}" />
</StackPanel>
</Border>
<Button Margin="0,16,0,0"
HorizontalAlignment="Center"
Content="Disconnect device"
Click="Disconnect_Click"
Style="{StaticResource PrimaryButton}"
Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
</Border>
<Border Margin="0,0,0,16"
Style="{StaticResource SubtlePanel}"
Visibility="{Binding HasUpdateBanner, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="{Binding UpdateBannerTitle}"
FontSize="15"
FontWeight="Bold"
Foreground="{StaticResource Text}" />
<TextBlock Margin="0,4,0,0"
Text="{Binding UpdateBannerBody}"
Style="{StaticResource MutedText}" />
</StackPanel>
<Button Grid.Column="1"
Margin="16,0,0,0"
Content="{Binding UpdateBannerButtonText}"
Click="OpenUpdates_Click" />
</Grid>
</Border>
<Border Margin="0,0,0,20"
Background="{StaticResource AccentContainer}"
BorderBrush="{StaticResource BrandPrimary}"
BorderThickness="1"
CornerRadius="10"
Padding="16"
Visibility="{Binding HasPairingApprovals, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel>
<TextBlock Text="Pairing requests"
FontSize="18"
FontWeight="Bold"
Foreground="{StaticResource OnAccentContainer}" />
<ItemsControl Margin="0,12,0,0"
ItemsSource="{Binding PairingApprovals}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Margin="0,0,0,10"
Padding="12"
BorderBrush="{StaticResource BrandPrimary}"
BorderThickness="1"
CornerRadius="8"
Background="White">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="{Binding DeviceName}"
FontSize="14"
FontWeight="Bold"
Foreground="{StaticResource Text}" />
<TextBlock Margin="0,4,0,0"
Text="{Binding VerificationCode, StringFormat=Verification code {0}}"
Foreground="{StaticResource Text}"
FontSize="13"
FontWeight="Bold" />
</StackPanel>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
Margin="16,0,0,0"
VerticalAlignment="Center">
<Button Padding="14,0"
Tag="{Binding RequestId}"
Click="AcceptPairing_Click"
Content="Accept"
Style="{StaticResource PrimaryButton}" />
<Button Margin="8,0,0,0"
Padding="14,0"
Tag="{Binding RequestId}"
Click="RejectPairing_Click"
Content="Reject" />
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
<Expander Header="Troubleshooting"
Foreground="{StaticResource Text}"
FontWeight="Bold">
<Grid Margin="0,14,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="System Bluetooth" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SystemBluetooth}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0,8,0,0" Text="Bluetooth capabilities" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="1" Grid.Column="1" Margin="0,8,0,0" Text="{Binding BluetoothCapabilities}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,8,0,0" Text="Bluetooth last checked" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="2" Grid.Column="1" Margin="0,8,0,0" Text="{Binding BluetoothLastChecked}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="3" Grid.Column="0" Margin="0,8,0,0" Text="Bluetooth last changed" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="3" Grid.Column="1" Margin="0,8,0,0" Text="{Binding BluetoothLastChanged}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="4" Grid.Column="0" Margin="0,8,0,0" Text="Last Bluetooth event" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="4" Grid.Column="1" Margin="0,8,0,0" Text="{Binding LastBluetoothEvent}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="5" Grid.Column="0" Margin="0,8,0,0" Text="Recent Bluetooth events" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="5" Grid.Column="1" Margin="0,8,0,0" Text="{Binding RecentBluetoothEvents}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="6" Grid.Column="0" Margin="0,8,0,0" Text="Last disconnect" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="6" Grid.Column="1" Margin="0,8,0,0" Text="{Binding LastDisconnectReason}" Style="{StaticResource DetailValue}" />
<TextBlock Grid.Row="7" Grid.Column="0" Margin="0,8,0,0" Text="Recent Bluetooth error" Style="{StaticResource DetailLabel}" />
<TextBlock Grid.Row="7" Grid.Column="1" Margin="0,8,0,0" Text="{Binding RecentBluetoothError}" Style="{StaticResource DetailValue}" />
</Grid>
</Expander>
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
</Window>