-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirstTimeSetup.cs
More file actions
101 lines (89 loc) · 3.05 KB
/
FirstTimeSetup.cs
File metadata and controls
101 lines (89 loc) · 3.05 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
namespace AutoLogout
{
public partial class FirstTime : Form
{
public FirstTime()
{
Text = "AutoLogout Setup";
Icon = new Icon("Resources/icon-light.ico");
FormBorderStyle = FormBorderStyle.FixedDialog;
ShowInTaskbar = true;
StartPosition = FormStartPosition.CenterScreen;
MinimizeBox = false;
MaximizeBox = false;
BackColor = Color.White;
Width = 512;
Height = 480;
AutoScaleMode = AutoScaleMode.Dpi;
AutoScaleDimensions = new(96F, 96F);
int pageWidth = Width - 28;
TableLayoutPanel mainTable = new()
{
Dock = DockStyle.Top,
AutoSize = true,
ColumnCount = 1,
RowCount = 2,
};
FlowLayoutPanel buttonPanel = new()
{
Dock = DockStyle.Bottom,
AutoSize = true,
BackColor = SystemColors.Control,
Padding = new Padding(8),
};
PictureBox pictureBox = new()
{
Image = Image.FromFile(@"Resources\feature-graphic-desktop.jpg"),
SizeMode = PictureBoxSizeMode.Zoom,
Width = pageWidth,
Height = (int)(pageWidth * 0.3)
};
Label introLabel = new()
{
Text = "Welcome to AutoLogout!\n\nIt appears that this is the first time you have used " +
"AutoLogout. I can set up automatic start for you. Though there are some things you " +
"should note;",
Margin = new Padding(Top = 4),
AutoSize = true,
MaximumSize = new Size { Width = pageWidth },
};
Label disclaimerLabel = new()
{
Text = " - Toggling automatic start requires an administrator account.\n" +
" - AutoLogout should be in a folder that all accounts can see, but only admins can change.\n" +
" - If you used the installer, this is already set.\n" +
" - Once automatic start is enabled, you shouldn't move or delete AutoLogout.\n" +
" - You can configure this later in the ControlPanel.",
Font = new Font(introLabel.Font, FontStyle.Italic),
Margin = new Padding(Top = 4),
AutoSize = true,
MaximumSize = new Size { Width = pageWidth },
};
mainTable.Controls.Add(pictureBox);
mainTable.Controls.Add(introLabel);
mainTable.Controls.Add(disclaimerLabel);
Button ContinueButton = new() { Text = "Continue", AutoSize = true };
Button CancelButton = new() { Text = "Cancel", AutoSize = true };
ContinueButton.Click += ContinueButton_Click;
CancelButton.Click += CancelButton_Click;
buttonPanel.Controls.Add(ContinueButton);
buttonPanel.Controls.Add(CancelButton);
Controls.Add(mainTable);
Controls.Add(buttonPanel);
}
private void ContinueButton_Click(object? sender, EventArgs e)
{
Common.RelaunchAsAdmin("--register");
Close();
}
private void CancelButton_Click(object? sender, EventArgs e)
{
Close();
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
base.OnFormClosed(e);
Common.Relaunch("--skipsetup");
}
}
}