forked from plenteum/plenteum-wallet-winforms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PasswordPrompt.cs
53 lines (45 loc) · 1.63 KB
/
PasswordPrompt.cs
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
using System;
using System.Windows.Forms;
namespace PlenteumWallet
{
public partial class PasswordPrompt : PlenteumWalletForm
{
public string WalletPassword { get; set; }
public PasswordPrompt()
{
InitializeComponent();
this.Text = Application.ProductName;
walletPasswordLabel.Text = String.Format("{0} Wallet Password:", System.IO.Path.GetFileNameWithoutExtension(Properties.Settings.Default.walletPath));
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
Utilities.CloseProgram(e);
}
private void PasswordText_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (passwordText.Text != "" && passwordText.Text.Length > 6)
{
WalletPassword = passwordText.Text;
Utilities.SetDialogResult(this, DialogResult.OK);
Utilities.Close(this);
}
}
}
private void CancelButton_Click(object sender, EventArgs e)
{
DialogResult dialogResult = MessageBox.Show("Are you sure you want to cancel?", "Plenteum Wallet Cancel?", MessageBoxButtons.YesNo);
if (dialogResult == DialogResult.Yes)
{
Utilities.Close(this);
}
}
private void CreateWalletButton_Click(object sender, EventArgs e)
{
WalletPassword = passwordText.Text;
Utilities.SetDialogResult(this, DialogResult.OK);
Utilities.Close(this);
}
}
}