From 825797024f442b5f638205ad4bf77a9e2ab8baea Mon Sep 17 00:00:00 2001 From: Sigmanor Date: Sat, 9 Jan 2016 21:31:14 +0200 Subject: [PATCH] MsgBox's placed in the middle of the parent forms --- EncryptPad/ChangeKeyForm.cs | 8 ++++++-- EncryptPad/SettingsForm.cs | 21 ++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/EncryptPad/ChangeKeyForm.cs b/EncryptPad/ChangeKeyForm.cs index 17d5b3d..2fc7340 100644 --- a/EncryptPad/ChangeKeyForm.cs +++ b/EncryptPad/ChangeKeyForm.cs @@ -22,12 +22,16 @@ private void button1_Click(object sender, EventArgs e) if (textBox1.Text == MainWindow.key) { MainWindow.key = textBox2.Text; + MainWindow.keyChanged = true; this.Close(); } - else if (textBox1.Text != MainWindow.key) + else if (textBox1.Text != MainWindow.key) { - MessageBox.Show("Wrong old key!"); + using (new CenterWinDialog(this)) + { + MessageBox.Show("Wrong old key!"); + } } } diff --git a/EncryptPad/SettingsForm.cs b/EncryptPad/SettingsForm.cs index 240e895..0c7c1fe 100644 --- a/EncryptPad/SettingsForm.cs +++ b/EncryptPad/SettingsForm.cs @@ -60,9 +60,10 @@ private void saveSettingsButton_Click(object sender, EventArgs e) ps.KeySize = Convert.ToInt32(comboBox3.Text.ToString()); ps.TheSalt = textBox1.Text; ps.PasswordIterations = Convert.ToInt32(textBox2.Text.ToString()); - ps.Save(); + MainWindow.settingsChanged = true; + this.Hide(); } @@ -89,24 +90,30 @@ public static void DissociateExtension(string applicationExecutablePath, string private void panel1_Click_1(object sender, EventArgs e) { colorDialog1.Color = panel1.BackColor; - MessageBoxCenter.PrepToCenterMessageBoxOnForm(this); - colorDialog1.ShowDialog(); + using (new CenterWinDialog(this)) + { + colorDialog1.ShowDialog(); + } panel1.BackColor = colorDialog1.Color; } private void panel2_Click(object sender, EventArgs e) { colorDialog1.Color = panel2.BackColor; - MessageBoxCenter.PrepToCenterMessageBoxOnForm(this); - colorDialog1.ShowDialog(); + using (new CenterWinDialog(this)) + { + colorDialog1.ShowDialog(); + } panel2.BackColor = colorDialog1.Color; } private void panel3_Click(object sender, EventArgs e) { colorDialog1.Color = panel3.BackColor; - MessageBoxCenter.PrepToCenterMessageBoxOnForm(this); - colorDialog1.ShowDialog(); + using (new CenterWinDialog(this)) + { + colorDialog1.ShowDialog(); + } panel3.BackColor = colorDialog1.Color; } }