summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-10-27 21:13:52 +0100
committeremkael <emkael@tlen.pl>2019-10-27 21:13:52 +0100
commite6d4f5711f3063f961e78963ba0bd8fd3d3b4f72 (patch)
treefce3f2d379f93de93c8d5db68ff46d71813b769b
parentd5dcad97780a7bdac8bb52dca810ef7230727c8f (diff)
Fixing a bug that did not take settings into account when enabling controls on first configuration run (because ShowDialog distrupts main form event loop)
-rw-r--r--spedytor/Form1.Designer.cs2
-rw-r--r--spedytor/Form1.cs18
-rw-r--r--spedytor/MysqlSettings.cs2
3 files changed, 16 insertions, 6 deletions
diff --git a/spedytor/Form1.Designer.cs b/spedytor/Form1.Designer.cs
index d504306..32913cc 100644
--- a/spedytor/Form1.Designer.cs
+++ b/spedytor/Form1.Designer.cs
@@ -255,7 +255,7 @@
this.Name = "Form1";
this.Text = "Spedytor";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
- this.Load += new System.EventHandler(this.Form1_Load);
+ this.Shown += new System.EventHandler(this.Form1_Shown);
this.Resize += new System.EventHandler(this.Form1_Resize);
((System.ComponentModel.ISupportInitialize)(this.nInterval)).EndInit();
this.contextMenuStrip.ResumeLayout(false);
diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs
index ce82b80..4448d8e 100644
--- a/spedytor/Form1.cs
+++ b/spedytor/Form1.cs
@@ -44,10 +44,17 @@ namespace spedytor
this.Dispose();
}
- private void Form1_Load(object sender, EventArgs e)
+ private void Form1_Shown(object sender, EventArgs e)
{
- if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog();
- if (!MySQL.getConfigured()) this.Dispose();
+ if (!MySQL.getConfigured())
+ {
+ (new MysqlSettings()).ShowDialog();
+ }
+ if (!MySQL.getConfigured())
+ {
+ this.Dispose();
+ return;
+ }
this.restoreSettings();
this.refreshDatabaseList();
this.checkS3Options();
@@ -387,7 +394,10 @@ namespace spedytor
private void restoreSettings()
{
- this.setSelectedDBs(Properties.OptionSettings.Default.DB_NAMES.Cast<string>().ToList());
+ if (Properties.OptionSettings.Default.DB_NAMES != null)
+ {
+ this.setSelectedDBs(Properties.OptionSettings.Default.DB_NAMES.Cast<string>().ToList());
+ }
this.cSend.Checked = Properties.OptionSettings.Default.SEND_FLAG;
this.nInterval.Value = Properties.OptionSettings.Default.RUN_INTERVAL;
}
diff --git a/spedytor/MysqlSettings.cs b/spedytor/MysqlSettings.cs
index bce4f01..af7c636 100644
--- a/spedytor/MysqlSettings.cs
+++ b/spedytor/MysqlSettings.cs
@@ -63,7 +63,7 @@ namespace spedytor
{
Properties.Settings.Default.CONFIGURED = true;
Properties.Settings.Default.Save();
- Close();
+ Dispose();
}
else
{