From 399ba9d9351cddc115191e968610fbaeb9ac22c4 Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 14 Oct 2018 16:19:00 +0200 Subject: Remebering S3 bucket ID between application runs --- spedytor/Form1.Designer.cs | 1 + spedytor/Form1.cs | 9 ++++++++- spedytor/Properties/Settings.Designer.cs | 12 ++++++++++++ spedytor/Properties/Settings.settings | 3 +++ spedytor/app.config | 3 +++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/spedytor/Form1.Designer.cs b/spedytor/Form1.Designer.cs index 5942c7f..aeb0655 100644 --- a/spedytor/Form1.Designer.cs +++ b/spedytor/Form1.Designer.cs @@ -123,6 +123,7 @@ this.MinimizeBox = false; 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.ResumeLayout(false); this.PerformLayout(); diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs index 3b7676c..b8f0e35 100644 --- a/spedytor/Form1.cs +++ b/spedytor/Form1.cs @@ -19,7 +19,7 @@ namespace spedytor private void bExit_Click(object sender, EventArgs e) { - this.Dispose(); + this.Close(); } private void cSend_CheckedChanged(object sender, EventArgs e) @@ -36,6 +36,7 @@ namespace spedytor if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog(); if (!MySQL.getConfigured()) this.Dispose(); this.refreshDatabaseList(); + this.tBucketID.Text = Properties.Settings.Default.S3_BUCKET; } private void bSettings_Click(object sender, EventArgs e) @@ -100,5 +101,11 @@ namespace spedytor this.bSave_Click(null, null); } } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + Properties.Settings.Default.S3_BUCKET = this.tBucketID.Text; + Properties.Settings.Default.Save(); + } } } diff --git a/spedytor/Properties/Settings.Designer.cs b/spedytor/Properties/Settings.Designer.cs index 9508165..52df391 100644 --- a/spedytor/Properties/Settings.Designer.cs +++ b/spedytor/Properties/Settings.Designer.cs @@ -82,5 +82,17 @@ namespace spedytor.Properties { this["CONFIGURED"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string S3_BUCKET { + get { + return ((string)(this["S3_BUCKET"])); + } + set { + this["S3_BUCKET"] = value; + } + } } } diff --git a/spedytor/Properties/Settings.settings b/spedytor/Properties/Settings.settings index 503268a..df8332a 100644 --- a/spedytor/Properties/Settings.settings +++ b/spedytor/Properties/Settings.settings @@ -17,5 +17,8 @@ False + + + \ No newline at end of file diff --git a/spedytor/app.config b/spedytor/app.config index e4e8f12..ee6fa55 100644 --- a/spedytor/app.config +++ b/spedytor/app.config @@ -24,6 +24,9 @@ False + + + -- cgit v1.2.3