diff options
-rw-r--r-- | spedytor/Form1.cs | 11 | ||||
-rw-r--r-- | spedytor/MysqlSettings.Designer.cs | 153 | ||||
-rw-r--r-- | spedytor/MysqlSettings.cs | 7 |
3 files changed, 157 insertions, 14 deletions
diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs index b8f0e35..6533a0f 100644 --- a/spedytor/Form1.cs +++ b/spedytor/Form1.cs @@ -37,12 +37,23 @@ namespace spedytor if (!MySQL.getConfigured()) this.Dispose(); this.refreshDatabaseList(); this.tBucketID.Text = Properties.Settings.Default.S3_BUCKET; + this.checkS3Options(); + } + + private void checkS3Options() + { + cSend.Enabled = (Properties.S3Settings.Default.AWS_ACCESS_KEY.Length > 0 && Properties.S3Settings.Default.AWS_SECRET_KEY.Length > 0); + if (!cSend.Enabled) + { + cSend.Checked = false; + } } private void bSettings_Click(object sender, EventArgs e) { (new MysqlSettings()).ShowDialog(); this.refreshDatabaseList(); + this.checkS3Options(); } internal void refreshDatabaseList() diff --git a/spedytor/MysqlSettings.Designer.cs b/spedytor/MysqlSettings.Designer.cs index 2c233b8..55f0d45 100644 --- a/spedytor/MysqlSettings.Designer.cs +++ b/spedytor/MysqlSettings.Designer.cs @@ -34,25 +34,37 @@ this.ePass = new System.Windows.Forms.TextBox(); this.ePort = new System.Windows.Forms.TextBox(); this.bOk = new System.Windows.Forms.Button(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.eS3ID = new System.Windows.Forms.TextBox(); + this.eS3Key = new System.Windows.Forms.TextBox(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // eHost // - this.eHost.Location = new System.Drawing.Point(12, 12); + this.eHost.Location = new System.Drawing.Point(49, 19); this.eHost.Name = "eHost"; this.eHost.Size = new System.Drawing.Size(100, 20); this.eHost.TabIndex = 0; // // eUser // - this.eUser.Location = new System.Drawing.Point(12, 38); + this.eUser.Location = new System.Drawing.Point(49, 45); this.eUser.Name = "eUser"; this.eUser.Size = new System.Drawing.Size(100, 20); this.eUser.TabIndex = 1; // // ePass // - this.ePass.Location = new System.Drawing.Point(12, 64); + this.ePass.Location = new System.Drawing.Point(49, 71); this.ePass.Name = "ePass"; this.ePass.PasswordChar = '*'; this.ePass.Size = new System.Drawing.Size(100, 20); @@ -60,39 +72,144 @@ // // ePort // - this.ePort.Location = new System.Drawing.Point(12, 90); + this.ePort.Location = new System.Drawing.Point(49, 97); this.ePort.Name = "ePort"; this.ePort.Size = new System.Drawing.Size(100, 20); this.ePort.TabIndex = 3; // // bOk // - this.bOk.Location = new System.Drawing.Point(12, 116); + this.bOk.Location = new System.Drawing.Point(12, 227); this.bOk.Name = "bOk"; - this.bOk.Size = new System.Drawing.Size(100, 23); + this.bOk.Size = new System.Drawing.Size(155, 23); this.bOk.TabIndex = 4; this.bOk.Text = "OK"; this.bOk.UseVisualStyleBackColor = true; this.bOk.Click += new System.EventHandler(this.button1_Click); // + // groupBox1 + // + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.eHost); + this.groupBox1.Controls.Add(this.eUser); + this.groupBox1.Controls.Add(this.ePort); + this.groupBox1.Controls.Add(this.ePass); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(155, 126); + this.groupBox1.TabIndex = 5; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "MySQL"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(11, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(32, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Host:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(11, 48); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(32, 13); + this.label2.TabIndex = 5; + this.label2.Text = "User:"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(4, 74); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(39, 13); + this.label3.TabIndex = 6; + this.label3.Text = "Hasło:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(14, 100); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(29, 13); + this.label4.TabIndex = 7; + this.label4.Text = "Port:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.label7); + this.groupBox2.Controls.Add(this.label8); + this.groupBox2.Controls.Add(this.eS3ID); + this.groupBox2.Controls.Add(this.eS3Key); + this.groupBox2.Location = new System.Drawing.Point(12, 144); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(155, 77); + this.groupBox2.TabIndex = 8; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "S3"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(7, 48); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(36, 13); + this.label7.TabIndex = 5; + this.label7.Text = "Klucz:"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(22, 22); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(21, 13); + this.label8.TabIndex = 4; + this.label8.Text = "ID:"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // eS3ID + // + this.eS3ID.Location = new System.Drawing.Point(49, 19); + this.eS3ID.Name = "eS3ID"; + this.eS3ID.Size = new System.Drawing.Size(100, 20); + this.eS3ID.TabIndex = 0; + // + // eS3Key + // + this.eS3Key.Location = new System.Drawing.Point(49, 45); + this.eS3Key.Name = "eS3Key"; + this.eS3Key.Size = new System.Drawing.Size(100, 20); + this.eS3Key.TabIndex = 1; + // // MysqlSettings // this.AcceptButton = this.bOk; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(124, 147); + this.ClientSize = new System.Drawing.Size(179, 260); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); this.Controls.Add(this.bOk); - this.Controls.Add(this.ePort); - this.Controls.Add(this.ePass); - this.Controls.Add(this.eUser); - this.Controls.Add(this.eHost); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "MysqlSettings"; - this.Text = "Ustawienia MySQL"; + this.Text = "Ustawienia"; this.Load += new System.EventHandler(this.MysqlSettings_Load); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -103,5 +220,15 @@ private System.Windows.Forms.TextBox ePass; private System.Windows.Forms.TextBox ePort; private System.Windows.Forms.Button bOk; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.TextBox eS3ID; + private System.Windows.Forms.TextBox eS3Key; } }
\ No newline at end of file diff --git a/spedytor/MysqlSettings.cs b/spedytor/MysqlSettings.cs index c597bbd..89b6515 100644 --- a/spedytor/MysqlSettings.cs +++ b/spedytor/MysqlSettings.cs @@ -21,6 +21,8 @@ namespace spedytor eUser.Text = Properties.Settings.Default.USER; ePass.Text = Properties.Settings.Default.PASS; ePort.Text = Properties.Settings.Default.PORT; + eS3ID.Text = Properties.S3Settings.Default.AWS_ACCESS_KEY; + eS3Key.Text = Properties.S3Settings.Default.AWS_SECRET_KEY; } private void button1_Click(object sender, EventArgs e) @@ -29,6 +31,9 @@ namespace spedytor Properties.Settings.Default.USER = eUser.Text; Properties.Settings.Default.PASS = ePass.Text; Properties.Settings.Default.PORT = ePort.Text; + Properties.S3Settings.Default.AWS_ACCESS_KEY = eS3ID.Text; + Properties.S3Settings.Default.AWS_SECRET_KEY = eS3Key.Text; + Properties.S3Settings.Default.Save(); string msg = MySQL.test(); if (msg == "") @@ -39,7 +44,7 @@ namespace spedytor } else { - MessageBox.Show(msg, "Nieprawidłowe ustawienia", MessageBoxButtons.OK, MessageBoxIcon.Stop); + MessageBox.Show(msg, "Nieprawidłowe ustawienia MySQL", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } } |