diff options
author | emkael <emkael@tlen.pl> | 2018-11-16 20:22:57 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-10-27 14:53:42 +0100 |
commit | 725bc3d2571e4ef812570403a224d7b165709707 (patch) | |
tree | 4a717d6299684929250c39bb658822936afdde14 | |
parent | becf3691eb4691e952eb3bc37db97145ffd73c5b (diff) |
GUI for S3 settings and interval repeat worker
-rw-r--r-- | spedytor/Form1.Designer.cs | 104 | ||||
-rw-r--r-- | spedytor/Form1.cs | 31 | ||||
-rw-r--r-- | spedytor/Form1.resx | 3 |
3 files changed, 97 insertions, 41 deletions
diff --git a/spedytor/Form1.Designer.cs b/spedytor/Form1.Designer.cs index aeb0655..8b1f21b 100644 --- a/spedytor/Form1.Designer.cs +++ b/spedytor/Form1.Designer.cs @@ -28,81 +28,130 @@ /// </summary> private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.lChooseDatabase = new System.Windows.Forms.Label(); this.cbDatabaseName = new System.Windows.Forms.ComboBox(); this.cSend = new System.Windows.Forms.CheckBox(); - this.tBucketID = new System.Windows.Forms.TextBox(); + this.nInterval = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.tInterval = new System.Windows.Forms.Timer(this.components); + this.bTimer = new System.Windows.Forms.Button(); this.bExit = new System.Windows.Forms.Button(); this.bSettings = new System.Windows.Forms.Button(); this.bSave = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.nInterval)).BeginInit(); this.SuspendLayout(); // // lChooseDatabase // this.lChooseDatabase.AutoSize = true; - this.lChooseDatabase.Location = new System.Drawing.Point(9, 13); + this.lChooseDatabase.Location = new System.Drawing.Point(12, 11); this.lChooseDatabase.Name = "lChooseDatabase"; - this.lChooseDatabase.Size = new System.Drawing.Size(74, 13); + this.lChooseDatabase.Size = new System.Drawing.Size(34, 13); this.lChooseDatabase.TabIndex = 0; - this.lChooseDatabase.Text = "Wybierz bazę:"; + this.lChooseDatabase.Text = "Baza:"; // // cbDatabaseName // this.cbDatabaseName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbDatabaseName.FormattingEnabled = true; - this.cbDatabaseName.Location = new System.Drawing.Point(89, 10); + this.cbDatabaseName.Location = new System.Drawing.Point(52, 8); this.cbDatabaseName.Name = "cbDatabaseName"; - this.cbDatabaseName.Size = new System.Drawing.Size(138, 21); + this.cbDatabaseName.Size = new System.Drawing.Size(186, 21); this.cbDatabaseName.TabIndex = 1; // // cSend // this.cSend.AutoSize = true; - this.cSend.Location = new System.Drawing.Point(12, 37); + this.cSend.Location = new System.Drawing.Point(244, 10); this.cSend.Name = "cSend"; - this.cSend.Size = new System.Drawing.Size(83, 17); + this.cSend.Size = new System.Drawing.Size(50, 17); this.cSend.TabIndex = 2; - this.cSend.Text = "ślij Zimnemu"; + this.cSend.Text = "wyślij"; this.cSend.UseVisualStyleBackColor = true; - this.cSend.CheckedChanged += new System.EventHandler(this.cSend_CheckedChanged); // - // tBucketID - // - this.tBucketID.Enabled = false; - this.tBucketID.Location = new System.Drawing.Point(89, 35); - this.tBucketID.Name = "tBucketID"; - this.tBucketID.Size = new System.Drawing.Size(138, 20); - this.tBucketID.TabIndex = 3; - this.tBucketID.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tBucketID_KeyPress); + // nInterval + // + this.nInterval.Location = new System.Drawing.Point(224, 65); + this.nInterval.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.nInterval.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.nInterval.Name = "nInterval"; + this.nInterval.Size = new System.Drawing.Size(70, 20); + this.nInterval.TabIndex = 8; + this.nInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.nInterval.Value = new decimal(new int[] { + 5, + 0, + 0, + 0}); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(239, 88); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(32, 13); + this.label1.TabIndex = 9; + this.label1.Text = "minut"; + // + // tInterval + // + this.tInterval.Tick += new System.EventHandler(this.tInterval_Tick); + // + // bTimer + // + this.bTimer.Image = global::spedytor.Properties.Resources.refresh; + this.bTimer.Location = new System.Drawing.Point(153, 35); + this.bTimer.Name = "bTimer"; + this.bTimer.Size = new System.Drawing.Size(70, 70); + this.bTimer.TabIndex = 7; + this.bTimer.Text = "Zapisz co..."; + this.bTimer.TextAlign = System.Drawing.ContentAlignment.BottomCenter; + this.bTimer.UseVisualStyleBackColor = true; + this.bTimer.Click += new System.EventHandler(this.bTimer_Click); // // bExit // this.bExit.Image = global::spedytor.Properties.Resources.close; - this.bExit.Location = new System.Drawing.Point(152, 133); + this.bExit.Location = new System.Drawing.Point(224, 105); this.bExit.Name = "bExit"; this.bExit.Size = new System.Drawing.Size(70, 70); this.bExit.TabIndex = 6; + this.bExit.Text = "Wyjdź"; + this.bExit.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.bExit.UseVisualStyleBackColor = true; this.bExit.Click += new System.EventHandler(this.bExit_Click); // // bSettings // this.bSettings.Image = global::spedytor.Properties.Resources.settings; - this.bSettings.Location = new System.Drawing.Point(152, 63); + this.bSettings.Location = new System.Drawing.Point(153, 105); this.bSettings.Name = "bSettings"; this.bSettings.Size = new System.Drawing.Size(70, 70); this.bSettings.TabIndex = 5; + this.bSettings.Text = "Opcje..."; + this.bSettings.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.bSettings.UseVisualStyleBackColor = true; this.bSettings.Click += new System.EventHandler(this.bSettings_Click); // // bSave // this.bSave.Image = global::spedytor.Properties.Resources.save; - this.bSave.Location = new System.Drawing.Point(12, 63); + this.bSave.Location = new System.Drawing.Point(12, 35); this.bSave.Name = "bSave"; this.bSave.Size = new System.Drawing.Size(140, 140); this.bSave.TabIndex = 4; + this.bSave.Text = "Zapisz..."; + this.bSave.TextAlign = System.Drawing.ContentAlignment.BottomCenter; this.bSave.UseVisualStyleBackColor = true; this.bSave.Click += new System.EventHandler(this.bSave_Click); // @@ -110,11 +159,13 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(235, 212); + this.ClientSize = new System.Drawing.Size(307, 187); + this.Controls.Add(this.label1); + this.Controls.Add(this.nInterval); + this.Controls.Add(this.bTimer); this.Controls.Add(this.bExit); this.Controls.Add(this.bSettings); this.Controls.Add(this.bSave); - this.Controls.Add(this.tBucketID); this.Controls.Add(this.cSend); this.Controls.Add(this.cbDatabaseName); this.Controls.Add(this.lChooseDatabase); @@ -123,8 +174,8 @@ 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); + ((System.ComponentModel.ISupportInitialize)(this.nInterval)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -135,10 +186,13 @@ private System.Windows.Forms.Label lChooseDatabase; private System.Windows.Forms.ComboBox cbDatabaseName; private System.Windows.Forms.CheckBox cSend; - private System.Windows.Forms.TextBox tBucketID; private System.Windows.Forms.Button bSave; private System.Windows.Forms.Button bSettings; private System.Windows.Forms.Button bExit; + private System.Windows.Forms.Button bTimer; + private System.Windows.Forms.NumericUpDown nInterval; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Timer tInterval; } } diff --git a/spedytor/Form1.cs b/spedytor/Form1.cs index ce730c6..f68c1b3 100644 --- a/spedytor/Form1.cs +++ b/spedytor/Form1.cs @@ -22,15 +22,6 @@ namespace spedytor this.Close(); } - private void cSend_CheckedChanged(object sender, EventArgs e) - { - this.tBucketID.Enabled = this.cSend.Checked; - if (this.cSend.Checked) - { - this.tBucketID.Focus(); - } - } - private void Form1_Load(object sender, EventArgs e) { if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog(); @@ -70,6 +61,15 @@ namespace spedytor dbs.Close(); } + private string getBucketID() + { + if (this.cSend.Checked && spedytor.Properties.S3Settings.Default.AWS_BUCKET_ID.Length > 0) + { + return spedytor.Properties.S3Settings.Default.AWS_BUCKET_ID; + } + return null; + } + private void bSave_Click(object sender, EventArgs e) { this.Enabled = false; @@ -85,10 +85,10 @@ namespace spedytor c.close(); MessageBox.Show("Wyeksportowano pomyślnie do pliku: " + filePath, "Sukces eksportu!", MessageBoxButtons.OK, MessageBoxIcon.Information); if (cSend.Checked) { - if (tBucketID.Text.Length > 0) + if (this.getBucketID() != null) { S3 s3Client = new S3(); - s3Client.send(this.tBucketID.Text, filePath, this.cbDatabaseName.SelectedItem.ToString() + ".sql"); + s3Client.send(this.getBucketID(), filePath, this.cbDatabaseName.SelectedItem.ToString() + ".sql"); MessageBox.Show("Wysłano Zimnemu!", "Sukces eksportu!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else @@ -106,13 +106,12 @@ namespace spedytor Cursor.Current = Cursors.Default; } - private void tBucketID_KeyPress(object sender, KeyPressEventArgs e) + private void bTimer_Click(object sender, EventArgs e) { - if (e.KeyChar == (char)Keys.Return) - { - this.bSave_Click(null, null); - } } + private void tInterval_Tick(object sender, EventArgs e) + { + } } } diff --git a/spedytor/Form1.resx b/spedytor/Form1.resx index f41cdd1..e1a8c87 100644 --- a/spedytor/Form1.resx +++ b/spedytor/Form1.resx @@ -117,6 +117,9 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="tInterval.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </metadata> |