diff --git a/JiraTimeBotForm/JiraTimeBotForm.csproj b/JiraTimeBotForm/JiraTimeBotForm.csproj
index 3eb2929..c889879 100644
--- a/JiraTimeBotForm/JiraTimeBotForm.csproj
+++ b/JiraTimeBotForm/JiraTimeBotForm.csproj
@@ -112,6 +112,12 @@
+
+ Form
+
+
+ frmSettings.cs
+
@@ -127,6 +133,9 @@
True
Resources.resx
+
+ frmSettings.cs
+
SettingsSingleFileGenerator
diff --git a/JiraTimeBotForm/UI/frmMain.Designer.cs b/JiraTimeBotForm/UI/frmMain.Designer.cs
index 14862ee..ba106fd 100644
--- a/JiraTimeBotForm/UI/frmMain.Designer.cs
+++ b/JiraTimeBotForm/UI/frmMain.Designer.cs
@@ -30,17 +30,6 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
- this.actTime = new System.Windows.Forms.DateTimePicker();
- this.txtJiraLogin = new System.Windows.Forms.TextBox();
- this.lbl1 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.txtJiraPassword = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.txtMercurialEmail = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.btnSave = new System.Windows.Forms.Button();
- this.label4 = new System.Windows.Forms.Label();
- this.txtRepoPath = new System.Windows.Forms.TextBox();
this.txtLog = new System.Windows.Forms.TextBox();
this.btnStart = new System.Windows.Forms.Button();
this.ntfyIcon = new System.Windows.Forms.NotifyIcon(this.components);
@@ -48,116 +37,22 @@
this.txtDummyMode = new System.Windows.Forms.CheckBox();
this.btnMeeting = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
- this.chkAddComments = new System.Windows.Forms.CheckBox();
- this.label5 = new System.Windows.Forms.Label();
- this.txtRoundTo = new System.Windows.Forms.TextBox();
+ this.btnSettings = new System.Windows.Forms.Button();
this.SuspendLayout();
//
- // actTime
- //
- this.actTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
- this.actTime.Location = new System.Drawing.Point(100, 147);
- this.actTime.Name = "actTime";
- this.actTime.Size = new System.Drawing.Size(100, 20);
- this.actTime.TabIndex = 0;
- //
- // txtJiraLogin
- //
- this.txtJiraLogin.Location = new System.Drawing.Point(100, 42);
- this.txtJiraLogin.Name = "txtJiraLogin";
- this.txtJiraLogin.Size = new System.Drawing.Size(100, 20);
- this.txtJiraLogin.TabIndex = 1;
- //
- // lbl1
- //
- this.lbl1.AutoSize = true;
- this.lbl1.Location = new System.Drawing.Point(34, 45);
- this.lbl1.Name = "lbl1";
- this.lbl1.Size = new System.Drawing.Size(64, 13);
- this.lbl1.TabIndex = 2;
- this.lbl1.Text = "Логин Jira*:";
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(27, 71);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(71, 13);
- this.label1.TabIndex = 4;
- this.label1.Text = "Пароль Jira*:";
- //
- // txtJiraPassword
- //
- this.txtJiraPassword.Location = new System.Drawing.Point(100, 68);
- this.txtJiraPassword.Name = "txtJiraPassword";
- this.txtJiraPassword.PasswordChar = '*';
- this.txtJiraPassword.Size = new System.Drawing.Size(100, 20);
- this.txtJiraPassword.TabIndex = 3;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(12, 98);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(82, 13);
- this.label2.TabIndex = 6;
- this.label2.Text = "Mercurial name:";
- //
- // txtMercurialEmail
- //
- this.txtMercurialEmail.Location = new System.Drawing.Point(100, 95);
- this.txtMercurialEmail.Name = "txtMercurialEmail";
- this.txtMercurialEmail.Size = new System.Drawing.Size(100, 20);
- this.txtMercurialEmail.TabIndex = 5;
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(7, 151);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(91, 13);
- this.label3.TabIndex = 7;
- this.label3.Text = "Время запуска*:";
- //
- // btnSave
- //
- this.btnSave.Location = new System.Drawing.Point(78, 196);
- this.btnSave.Name = "btnSave";
- this.btnSave.Size = new System.Drawing.Size(75, 23);
- this.btnSave.TabIndex = 8;
- this.btnSave.Text = "Save";
- this.btnSave.UseVisualStyleBackColor = true;
- this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(18, 19);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(76, 13);
- this.label4.TabIndex = 10;
- this.label4.Text = "Путь до репо:";
- //
- // txtRepoPath
- //
- this.txtRepoPath.Location = new System.Drawing.Point(100, 16);
- this.txtRepoPath.Name = "txtRepoPath";
- this.txtRepoPath.Size = new System.Drawing.Size(100, 20);
- this.txtRepoPath.TabIndex = 9;
- //
// txtLog
//
- this.txtLog.Location = new System.Drawing.Point(218, 16);
+ this.txtLog.Location = new System.Drawing.Point(12, 16);
this.txtLog.Multiline = true;
this.txtLog.Name = "txtLog";
this.txtLog.ReadOnly = true;
this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.txtLog.Size = new System.Drawing.Size(510, 294);
+ this.txtLog.Size = new System.Drawing.Size(716, 294);
this.txtLog.TabIndex = 11;
//
// btnStart
//
- this.btnStart.Location = new System.Drawing.Point(9, 254);
+ this.btnStart.Location = new System.Drawing.Point(12, 324);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(114, 23);
this.btnStart.TabIndex = 12;
@@ -179,7 +74,7 @@
// txtDummyMode
//
this.txtDummyMode.AutoSize = true;
- this.txtDummyMode.Location = new System.Drawing.Point(9, 231);
+ this.txtDummyMode.Location = new System.Drawing.Point(208, 328);
this.txtDummyMode.Name = "txtDummyMode";
this.txtDummyMode.Size = new System.Drawing.Size(114, 17);
this.txtDummyMode.TabIndex = 13;
@@ -188,7 +83,7 @@
//
// btnMeeting
//
- this.btnMeeting.Location = new System.Drawing.Point(142, 254);
+ this.btnMeeting.Location = new System.Drawing.Point(132, 324);
this.btnMeeting.Name = "btnMeeting";
this.btnMeeting.Size = new System.Drawing.Size(70, 23);
this.btnMeeting.TabIndex = 14;
@@ -199,68 +94,39 @@
// btnCancel
//
this.btnCancel.Enabled = false;
- this.btnCancel.Location = new System.Drawing.Point(9, 286);
+ this.btnCancel.Location = new System.Drawing.Point(328, 324);
this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(203, 23);
+ this.btnCancel.Size = new System.Drawing.Size(190, 23);
this.btnCancel.TabIndex = 15;
this.btnCancel.Text = "Отменить операцию";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
- // chkAddComments
+ // btnSettings
//
- this.chkAddComments.AutoSize = true;
- this.chkAddComments.Location = new System.Drawing.Point(45, 175);
- this.chkAddComments.Name = "chkAddComments";
- this.chkAddComments.Size = new System.Drawing.Size(133, 17);
- this.chkAddComments.TabIndex = 16;
- this.chkAddComments.Text = "Добавлять описание";
- this.chkAddComments.UseVisualStyleBackColor = true;
- //
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(-2, 124);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(100, 13);
- this.label5.TabIndex = 18;
- this.label5.Text = "Округл. времени*:";
- //
- // txtRoundTo
- //
- this.txtRoundTo.Location = new System.Drawing.Point(100, 121);
- this.txtRoundTo.Name = "txtRoundTo";
- this.txtRoundTo.Size = new System.Drawing.Size(100, 20);
- this.txtRoundTo.TabIndex = 17;
- this.txtRoundTo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
+ this.btnSettings.Location = new System.Drawing.Point(645, 324);
+ this.btnSettings.Name = "btnSettings";
+ this.btnSettings.Size = new System.Drawing.Size(82, 23);
+ this.btnSettings.TabIndex = 16;
+ this.btnSettings.Text = "Настройки";
+ this.btnSettings.UseVisualStyleBackColor = true;
+ this.btnSettings.Click += new System.EventHandler(this.btnSettings_Click);
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(740, 318);
- this.Controls.Add(this.label5);
- this.Controls.Add(this.txtRoundTo);
- this.Controls.Add(this.chkAddComments);
+ this.ClientSize = new System.Drawing.Size(740, 357);
+ this.Controls.Add(this.btnSettings);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnMeeting);
this.Controls.Add(this.txtDummyMode);
this.Controls.Add(this.btnStart);
this.Controls.Add(this.txtLog);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.txtRepoPath);
- this.Controls.Add(this.btnSave);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.txtMercurialEmail);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.txtJiraPassword);
- this.Controls.Add(this.lbl1);
- this.Controls.Add(this.txtJiraLogin);
- this.Controls.Add(this.actTime);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "frmMain";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Бот логирования времени";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
@@ -271,18 +137,6 @@
}
#endregion
-
- private System.Windows.Forms.DateTimePicker actTime;
- private System.Windows.Forms.TextBox txtJiraLogin;
- private System.Windows.Forms.Label lbl1;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox txtJiraPassword;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.TextBox txtMercurialEmail;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Button btnSave;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.TextBox txtRepoPath;
private System.Windows.Forms.TextBox txtLog;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.NotifyIcon ntfyIcon;
@@ -290,9 +144,7 @@
private System.Windows.Forms.CheckBox txtDummyMode;
private System.Windows.Forms.Button btnMeeting;
private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.CheckBox chkAddComments;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.TextBox txtRoundTo;
+ private System.Windows.Forms.Button btnSettings;
}
}
diff --git a/JiraTimeBotForm/UI/frmMain.cs b/JiraTimeBotForm/UI/frmMain.cs
index 3370fe1..a67c6a7 100644
--- a/JiraTimeBotForm/UI/frmMain.cs
+++ b/JiraTimeBotForm/UI/frmMain.cs
@@ -24,6 +24,7 @@ namespace JiraTimeBotForm.UI
private readonly IAllTasksProcessors _tasksProcessors;
private readonly ITrayMenu _trayIcon;
private CancellationTokenSource _tokenSource;
+ private Settings _settings;
private CancellationTokenSource GetTokenSource()
{
@@ -45,11 +46,13 @@ namespace JiraTimeBotForm.UI
_trayIcon = _container.Resolve();
_trayIcon.Create(this);
+ _settings = Settings.Load();
+
_job = _container.Resolve();
_log = _container.Resolve();
_tasksProcessors = _container.Resolve();
- _controls = new Control[] { txtJiraLogin, txtJiraPassword, txtMercurialEmail, actTime, txtRepoPath, txtDummyMode, btnSave, btnStart, btnMeeting, chkAddComments, txtRoundTo };
+ _controls = new Control[] { txtDummyMode, btnStart, btnMeeting, btnSettings };
}
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
@@ -59,26 +62,11 @@ namespace JiraTimeBotForm.UI
public Settings ReadSettingsAndLock()
{
- if (!int.TryParse(txtRoundTo.Text, out var roundTo))
- {
- roundTo = 15;
- }
-
- var settings = new Settings
- {
- JiraUserName = txtJiraLogin.Text,
- JiraPassword = txtJiraPassword.Text,
- MercurialAuthorEmail = txtMercurialEmail.Text,
- ActivationTime = TimeSpan.Parse(actTime.Text),
- RepositoryPath = txtRepoPath.Text,
- DummyMode = txtDummyMode.Checked,
- AddCommentsToWorklog = chkAddComments.Checked,
- RountToMinutes = roundTo
- };
+ _settings = Settings.Load();
LockUnlock(false);
- return settings;
+ return _settings;
}
public void LockUnlock(bool enabled)
@@ -91,41 +79,9 @@ namespace JiraTimeBotForm.UI
btnCancel.Enabled = !enabled;
tmrStart.Enabled = enabled;
}
-
- private void btnSave_Click(object sender, EventArgs e)
- {
- var settings = ReadSettingsAndLock();
- LockUnlock(true);
-
- settings.Save();
-
- MessageBox.Show("Settings saved.");
- settings = Settings.Load();
- if (settings != null)
- {
- SetSettings(settings);
- }
- }
-
private void Form1_Load(object sender, EventArgs e)
{
- var settings = Settings.Load();
- if (settings != null)
- {
- SetSettings(settings);
- }
- }
-
- private void SetSettings(Settings settings)
- {
- txtJiraLogin.Text = settings.JiraUserName;
- txtJiraPassword.Text = settings.JiraPassword;
- txtMercurialEmail.Text = settings.MercurialAuthorEmail;
- txtRepoPath.Text = settings.RepositoryPath;
- actTime.Text = settings.ActivationTime.ToString("hh\\:mm\\:ss");
- txtDummyMode.Checked = settings.DummyMode;
- chkAddComments.Checked = settings.AddCommentsToWorklog;
- txtRoundTo.Text = settings.RountToMinutes.ToString();
+ _settings = Settings.Load();
}
private async void btnStart_Click(object sender, EventArgs e)
@@ -156,7 +112,7 @@ namespace JiraTimeBotForm.UI
private async void tmrStart_Tick(object sender, EventArgs e)
{
- var runTime = TimeSpan.Parse(actTime.Text);
+ var runTime = _settings.ActivationTime;
if (Math.Abs((DateTime.Now.TimeOfDay - runTime).TotalSeconds) < 1)
{
@@ -208,5 +164,11 @@ namespace JiraTimeBotForm.UI
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
}
+
+ private void btnSettings_Click(object sender, EventArgs e)
+ {
+ var frm = new frmSettings();
+ frm.ShowDialog();
+ }
}
}
diff --git a/JiraTimeBotForm/UI/frmSettings.Designer.cs b/JiraTimeBotForm/UI/frmSettings.Designer.cs
new file mode 100644
index 0000000..e1d689c
--- /dev/null
+++ b/JiraTimeBotForm/UI/frmSettings.Designer.cs
@@ -0,0 +1,212 @@
+namespace JiraTimeBotForm.UI
+{
+ partial class frmSettings
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label5 = new System.Windows.Forms.Label();
+ this.txtRoundTo = new System.Windows.Forms.TextBox();
+ this.label4 = new System.Windows.Forms.Label();
+ this.txtRepoPath = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtMercurialEmail = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtJiraPassword = new System.Windows.Forms.TextBox();
+ this.lbl1 = new System.Windows.Forms.Label();
+ this.txtJiraLogin = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.actTime = new System.Windows.Forms.DateTimePicker();
+ this.chkAddComments = new System.Windows.Forms.CheckBox();
+ this.btnSave = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(7, 120);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(100, 13);
+ this.label5.TabIndex = 28;
+ this.label5.Text = "Округл. времени*:";
+ //
+ // txtRoundTo
+ //
+ this.txtRoundTo.Location = new System.Drawing.Point(109, 117);
+ this.txtRoundTo.Name = "txtRoundTo";
+ this.txtRoundTo.Size = new System.Drawing.Size(100, 20);
+ this.txtRoundTo.TabIndex = 27;
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(27, 15);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(76, 13);
+ this.label4.TabIndex = 26;
+ this.label4.Text = "Путь до репо:";
+ //
+ // txtRepoPath
+ //
+ this.txtRepoPath.Location = new System.Drawing.Point(109, 12);
+ this.txtRepoPath.Name = "txtRepoPath";
+ this.txtRepoPath.Size = new System.Drawing.Size(100, 20);
+ this.txtRepoPath.TabIndex = 25;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(21, 94);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(82, 13);
+ this.label2.TabIndex = 24;
+ this.label2.Text = "Mercurial name:";
+ //
+ // txtMercurialEmail
+ //
+ this.txtMercurialEmail.Location = new System.Drawing.Point(109, 91);
+ this.txtMercurialEmail.Name = "txtMercurialEmail";
+ this.txtMercurialEmail.Size = new System.Drawing.Size(100, 20);
+ this.txtMercurialEmail.TabIndex = 23;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(36, 67);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(71, 13);
+ this.label1.TabIndex = 22;
+ this.label1.Text = "Пароль Jira*:";
+ //
+ // txtJiraPassword
+ //
+ this.txtJiraPassword.Location = new System.Drawing.Point(109, 64);
+ this.txtJiraPassword.Name = "txtJiraPassword";
+ this.txtJiraPassword.PasswordChar = '*';
+ this.txtJiraPassword.Size = new System.Drawing.Size(100, 20);
+ this.txtJiraPassword.TabIndex = 21;
+ //
+ // lbl1
+ //
+ this.lbl1.AutoSize = true;
+ this.lbl1.Location = new System.Drawing.Point(43, 41);
+ this.lbl1.Name = "lbl1";
+ this.lbl1.Size = new System.Drawing.Size(64, 13);
+ this.lbl1.TabIndex = 20;
+ this.lbl1.Text = "Логин Jira*:";
+ //
+ // txtJiraLogin
+ //
+ this.txtJiraLogin.Location = new System.Drawing.Point(109, 38);
+ this.txtJiraLogin.Name = "txtJiraLogin";
+ this.txtJiraLogin.Size = new System.Drawing.Size(100, 20);
+ this.txtJiraLogin.TabIndex = 19;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(16, 147);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(91, 13);
+ this.label3.TabIndex = 30;
+ this.label3.Text = "Время запуска*:";
+ //
+ // actTime
+ //
+ this.actTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
+ this.actTime.Location = new System.Drawing.Point(109, 143);
+ this.actTime.Name = "actTime";
+ this.actTime.Size = new System.Drawing.Size(100, 20);
+ this.actTime.TabIndex = 29;
+ //
+ // chkAddComments
+ //
+ this.chkAddComments.AutoSize = true;
+ this.chkAddComments.Location = new System.Drawing.Point(39, 169);
+ this.chkAddComments.Name = "chkAddComments";
+ this.chkAddComments.Size = new System.Drawing.Size(133, 17);
+ this.chkAddComments.TabIndex = 31;
+ this.chkAddComments.Text = "Добавлять описание";
+ this.chkAddComments.UseVisualStyleBackColor = true;
+ //
+ // btnSave
+ //
+ this.btnSave.Location = new System.Drawing.Point(61, 203);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(75, 23);
+ this.btnSave.TabIndex = 32;
+ this.btnSave.Text = "Сохранить";
+ this.btnSave.UseVisualStyleBackColor = true;
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // frmSettings
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(220, 238);
+ this.Controls.Add(this.btnSave);
+ this.Controls.Add(this.chkAddComments);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.actTime);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.txtRoundTo);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.txtRepoPath);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.txtMercurialEmail);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtJiraPassword);
+ this.Controls.Add(this.lbl1);
+ this.Controls.Add(this.txtJiraLogin);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.MaximizeBox = false;
+ this.Name = "frmSettings";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
+ this.Text = "Настройки";
+ this.Load += new System.EventHandler(this.frmSettings_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.TextBox txtRoundTo;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox txtRepoPath;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtMercurialEmail;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtJiraPassword;
+ private System.Windows.Forms.Label lbl1;
+ private System.Windows.Forms.TextBox txtJiraLogin;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.DateTimePicker actTime;
+ private System.Windows.Forms.CheckBox chkAddComments;
+ private System.Windows.Forms.Button btnSave;
+ }
+}
\ No newline at end of file
diff --git a/JiraTimeBotForm/UI/frmSettings.cs b/JiraTimeBotForm/UI/frmSettings.cs
new file mode 100644
index 0000000..6aa3681
--- /dev/null
+++ b/JiraTimeBotForm/UI/frmSettings.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using JiraTimeBotForm.Configuration;
+
+namespace JiraTimeBotForm.UI
+{
+ public partial class frmSettings : Form
+ {
+ public frmSettings()
+ {
+ InitializeComponent();
+ }
+
+ private void frmSettings_Load(object sender, EventArgs e)
+ {
+ var settings = Settings.Load();
+ SetSettings(settings);
+ }
+
+ private void SetSettings(Settings settings)
+ {
+ txtJiraLogin.Text = settings.JiraUserName;
+ txtJiraPassword.Text = settings.JiraPassword;
+ txtMercurialEmail.Text = settings.MercurialAuthorEmail;
+ txtRepoPath.Text = settings.RepositoryPath;
+ actTime.Text = settings.ActivationTime.ToString("hh\\:mm\\:ss");
+ //txtDummyMode.Checked = settings.DummyMode;
+ chkAddComments.Checked = settings.AddCommentsToWorklog;
+ txtRoundTo.Text = settings.RountToMinutes.ToString();
+ }
+
+ public Settings ReadSettingsAndLock()
+ {
+ if (!int.TryParse(txtRoundTo.Text, out var roundTo))
+ {
+ roundTo = 15;
+ }
+
+ var settings = new Settings
+ {
+ JiraUserName = txtJiraLogin.Text,
+ JiraPassword = txtJiraPassword.Text,
+ MercurialAuthorEmail = txtMercurialEmail.Text,
+ ActivationTime = TimeSpan.Parse(actTime.Text),
+ RepositoryPath = txtRepoPath.Text,
+ //DummyMode = txtDummyMode.Checked,
+ AddCommentsToWorklog = chkAddComments.Checked,
+ RountToMinutes = roundTo
+ };
+
+ //LockUnlock(false);
+
+ return settings;
+ }
+
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ var settings = ReadSettingsAndLock();
+ settings.Save();
+ MessageBox.Show("Настройки сохранены.");
+ this.Close();
+ }
+ }
+}
diff --git a/JiraTimeBotForm/UI/frmSettings.resx b/JiraTimeBotForm/UI/frmSettings.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/JiraTimeBotForm/UI/frmSettings.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file