2016-01-07 16:45:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
2016-01-09 20:46:25 +00:00
|
|
|
|
namespace Crypto_Notepad
|
2016-01-07 16:45:32 +00:00
|
|
|
|
{
|
|
|
|
|
|
public partial class ChangeKeyForm : Form
|
|
|
|
|
|
{
|
|
|
|
|
|
public ChangeKeyForm()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2016-01-22 17:42:13 +00:00
|
|
|
|
if (textBox1.Text == MainWindow.key & textBox1.Text != textBox2.Text)
|
2016-01-07 16:45:32 +00:00
|
|
|
|
{
|
|
|
|
|
|
MainWindow.key = textBox2.Text;
|
2016-01-09 19:31:14 +00:00
|
|
|
|
MainWindow.keyChanged = true;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
this.Close();
|
2016-01-22 19:41:31 +00:00
|
|
|
|
return;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-22 17:42:13 +00:00
|
|
|
|
if (textBox1.Text != MainWindow.key)
|
2016-01-07 16:45:32 +00:00
|
|
|
|
{
|
2016-01-09 19:31:14 +00:00
|
|
|
|
using (new CenterWinDialog(this))
|
|
|
|
|
|
{
|
2016-01-22 17:42:13 +00:00
|
|
|
|
MessageBox.Show("Invalid old key!", "Change Key", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2016-01-09 19:31:14 +00:00
|
|
|
|
}
|
2016-01-22 17:42:13 +00:00
|
|
|
|
textBox1.Text = "";
|
|
|
|
|
|
textBox2.Text = "";
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (textBox1.Text == textBox2.Text)
|
|
|
|
|
|
{
|
|
|
|
|
|
using (new CenterWinDialog(this))
|
|
|
|
|
|
{
|
2016-01-22 19:41:31 +00:00
|
|
|
|
MessageBox.Show("New key is the same as old!", "Change Key", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
2016-01-22 17:42:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
textBox1.Text = "";
|
|
|
|
|
|
textBox2.Text = "";
|
|
|
|
|
|
return;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox1_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (textBox1.UseSystemPasswordChar == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
textBox1.UseSystemPasswordChar = false;
|
2016-01-11 17:56:14 +00:00
|
|
|
|
pictureBox1.Image = Properties.Resources.eye_half;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (textBox1.UseSystemPasswordChar == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
textBox1.UseSystemPasswordChar = true;
|
2016-01-11 17:56:14 +00:00
|
|
|
|
pictureBox1.Image = Properties.Resources.eye;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void pictureBox2_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (textBox2.UseSystemPasswordChar == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
textBox2.UseSystemPasswordChar = false;
|
2016-01-11 17:56:14 +00:00
|
|
|
|
pictureBox2.Image = Properties.Resources.eye_half;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (textBox2.UseSystemPasswordChar == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
textBox2.UseSystemPasswordChar = true;
|
2016-01-11 17:56:14 +00:00
|
|
|
|
pictureBox2.Image = Properties.Resources.eye;
|
2016-01-07 16:45:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-01-10 12:29:19 +00:00
|
|
|
|
|
|
|
|
|
|
private void ChangeKeyForm_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2016-01-20 19:24:04 +00:00
|
|
|
|
|
|
|
|
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (textBox1.Text.Length > 0 & textBox2.Text.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
button1.Enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
button1.Enabled = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void textBox2_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (textBox1.Text.Length > 0 & textBox2.Text.Length > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
button1.Enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
button1.Enabled = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-01-07 16:45:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|