-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasswordInputDialog.cs
More file actions
70 lines (59 loc) · 2 KB
/
Copy pathPasswordInputDialog.cs
File metadata and controls
70 lines (59 loc) · 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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BitLockerManager
{
public partial class PasswordInputDialog : Form
{
private TextBox passwordTextBox = null!;
private Button okButton = null!;
private Button cancelButton = null!;
public string Password => passwordTextBox.Text;
public PasswordInputDialog()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.Text = "Enter BitLocker Password";
this.Size = new Size(350, 150);
this.StartPosition = FormStartPosition.CenterParent;
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
var label = new Label
{
Text = "Enter the password to unlock the BitLocker drive:",
Location = new Point(10, 15),
Size = new Size(320, 20)
};
passwordTextBox = new TextBox
{
Location = new Point(10, 40),
Size = new Size(320, 25),
UseSystemPasswordChar = true
};
okButton = new Button
{
Text = "OK",
Location = new Point(175, 75),
Size = new Size(75, 30),
DialogResult = DialogResult.OK
};
cancelButton = new Button
{
Text = "Cancel",
Location = new Point(255, 75),
Size = new Size(75, 30),
DialogResult = DialogResult.Cancel
};
this.Controls.AddRange(new Control[] {
label, passwordTextBox, okButton, cancelButton
});
this.AcceptButton = okButton;
this.CancelButton = cancelButton;
// Focus on password textbox when dialog opens
this.Shown += (s, e) => passwordTextBox.Focus();
}
}
}