-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDestructiveActionDialog.cs
More file actions
63 lines (55 loc) · 1.87 KB
/
Copy pathDestructiveActionDialog.cs
File metadata and controls
63 lines (55 loc) · 1.87 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
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Layout;
using Avalonia.Media;
namespace QuestStack;
internal sealed class DestructiveActionDialog : Window
{
public DestructiveActionDialog(DeviceIdentity device)
{
Title = "Confirm Quest 1 unlock";
Width = 520;
SizeToContent = SizeToContent.Height;
CanResize = false;
ShowInTaskbar = false;
WindowStartupLocation = WindowStartupLocation.CenterOwner;
Background = Ui.Background;
var title = Ui.Text("Unlock and erase this headset?", 22, Ui.PrimaryText, FontWeight.SemiBold);
var intro = Ui.Text(
$"This will unlock {device.Serial} and erase its user data.",
14,
Ui.SecondaryText);
var warning = Ui.Card(
Ui.Text("Keep the USB cable connected until the headset reboots.", 13, Ui.Danger, FontWeight.SemiBold),
new Thickness(14));
warning.BorderBrush = Ui.Danger;
var cancel = Ui.SecondaryButton("Cancel");
cancel.Click += (_, _) => Close(false);
var confirm = Ui.PrimaryButton("Unlock and erase");
confirm.Click += (_, _) => Close(true);
var actions = new StackPanel
{
Orientation = Orientation.Horizontal,
HorizontalAlignment = HorizontalAlignment.Right,
Spacing = 10
};
actions.Children.Add(cancel);
actions.Children.Add(confirm);
var content = new StackPanel
{
Margin = new Thickness(26),
Spacing = 18
};
content.Children.Add(title);
content.Children.Add(intro);
content.Children.Add(warning);
content.Children.Add(actions);
Content = content;
KeyDown += (_, args) =>
{
if (args.Key == Key.Escape)
Close(false);
};
}
}