forked from gavinkendall/autoscreen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormEnterPassphrase.cs
68 lines (62 loc) · 1.92 KB
/
FormEnterPassphrase.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//-----------------------------------------------------------------------
// <copyright file="FormEnterPassphrase.cs" company="Gavin Kendall">
// Copyright (c) Gavin Kendall. All rights reserved.
// </copyright>
// <author>Gavin Kendall</author>
// <summary></summary>
//-----------------------------------------------------------------------
namespace AutoScreenCapture
{
using System;
using System.Windows.Forms;
/// <summary>
///
/// </summary>
public partial class FormEnterPassphrase : Form
{
public ScreenCapture screenCapture { get; set; }
/// <summary>
///
/// </summary>
public FormEnterPassphrase()
{
InitializeComponent();
}
private void FormEnterPassphrase_Load(object sender, EventArgs e)
{
textBoxPassphrase.Text = string.Empty;
textBoxPassphrase.Focus();
}
private void Click_buttonCancel(object sender, EventArgs e)
{
Close();
}
private void Click_buttonUnlock(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(textBoxPassphrase.Text))
{
if (Security.Hash(textBoxPassphrase.Text).Equals(Settings.User.GetByKey("StringPassphrase", defaultValue: string.Empty).Value))
{
ScreenCapture.LockScreenCaptureSession = false;
Close();
}
else
{
textBoxPassphrase.Clear();
textBoxPassphrase.Focus();
}
}
}
private void TextChanged_textBoxPassphrase(object sender, EventArgs e)
{
if (textBoxPassphrase.Text.Length > 0)
{
buttonUnlock.Enabled = true;
}
else
{
buttonUnlock.Enabled = false;
}
}
}
}