Compare commits

..
10 Commits
10 changed files with 247 additions and 142 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.38
1.0.48
+1 -1
View File
@@ -9,7 +9,7 @@ namespace JiraTimeBot.Configuration
{
public class Settings
{
public int MinuterPerWorkDay = 8 * 60;
public int MinuterPerWorkDay { get; set; }
public int RountToMinutes { get; set; }
public string JiraUrl = "https://myteam.aeroclub.ru";
+25 -6
View File
@@ -123,24 +123,37 @@ namespace JiraTimeBot.JiraIntegration
var userWorklogs = workLogs.Where(w =>
w.StartDate.GetValueOrDefault().Date == date && w.Author.Equals(settings.JiraUserName,
StringComparison.InvariantCultureIgnoreCase)).ToList();
var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings);
foreach (var workLog in userWorklogs)
{
var timeSpent = TimeSpan.FromSeconds(workLog.TimeSpentInSeconds);
var timeDiff = Math.Abs((timeSpent - taskTimeItem.Time).TotalMinutes);
if (timeDiff > 1 || userWorklogs.Count > 1)
if (timeDiff > 1 || userWorklogs.Count > 1 || userWorklogs.First().Comment != comment)
{
if (timeDiff > 1)
{
_log.Trace($"Время отличается на {timeDiff} минут, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
}
else
else if (userWorklogs.Count > 1)
{
_log.Trace($"Найдено более одного ворклога на задачу, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
}
else
{
_log.Trace($"Описание отличается, удаляю worklog: {taskTimeItem.Branch} {workLog.Author} {workLog.CreateDate}: {workLog.TimeSpent}");
}
if (!dummy)
{
issue.DeleteWorklogAsync(workLog, token: cancellationToken);
try
{
issue.DeleteWorklogAsync(workLog, token: cancellationToken);
}
catch (Exception ex)
{
_log.Error($"Не могу удалить Worklog по задаче {taskTimeItem.Branch}: {ex.Message}.");
continue;
}
}
hasTodayWorklog = false;
}
@@ -155,12 +168,18 @@ namespace JiraTimeBot.JiraIntegration
{
var timeSpentJira = $"{taskTimeItem.Time.TotalMinutes}m";
var comment = _descriptionSource.GetDescription(taskTimeItem, addCommentsToWorklog, settings);
Worklog workLogToAdd = new Worklog(timeSpentJira, date.Value, comment);
if (!dummy)
{
workLogToAdd = issue.AddWorklogAsync(workLogToAdd, token: cancellationToken).Result;
try
{
workLogToAdd = issue.AddWorklogAsync(workLogToAdd, token: cancellationToken).Result;
}
catch (Exception ex)
{
_log.Error($"Не могу добавить Worklog по задаче {taskTimeItem.Branch}: {ex.Message}.");
continue;
}
}
_log.Trace($"Добавили Worklog для {taskTimeItem.Branch}: {workLogToAdd.Author} {workLogToAdd.CreateDate}: {workLogToAdd.TimeSpent}");
}
+4
View File
@@ -49,6 +49,10 @@ namespace JiraTimeBot
{
return;
}
if (cancellationToken.IsCancellationRequested)
{
return;
}
_log.Warn($"{realDate:dd.MM.yyyy} вы не сделали ничего полезного =) Использую предыдущий день.");
daysDiff--;
+31 -31
View File
@@ -1,31 +1,31 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JiraTimeBot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JiraTimeBot")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.38")]
[assembly: AssemblyFileVersion("1.0.38")]
[assembly: AssemblyInformationalVersion("1.0.38")]
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("JiraTimeBot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JiraTimeBot")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f3b89316-c38c-4ce6-9d88-0b1373cfba1a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.48")]
[assembly: AssemblyFileVersion("1.0.48")]
[assembly: AssemblyInformationalVersion("1.0.48")]
@@ -21,7 +21,7 @@ namespace JiraTimeBot.TaskTime
public List<TaskTimeItem> CalculateTaskTime(List<MercurialCommitItem> commits, Settings settings, CancellationToken cancellationToken = default(CancellationToken))
{
int minutesPerWorkDay = settings.MinuterPerWorkDay;
int remainMinutes = settings.MinuterPerWorkDay;
int workHours = (settings.MinuterPerWorkDay / 60);
int totalCommitsCount = commits.Count;
if (!commits.Any())
@@ -30,7 +30,7 @@ namespace JiraTimeBot.TaskTime
}
//если кол-во коммитов более чем кол-во интервалов - то уменьшим интервал вдвое.
while (totalCommitsCount > (8 * (60.0 / settings.RountToMinutes)))
while (totalCommitsCount > (workHours * (60.0 / settings.RountToMinutes)))
{
settings.RountToMinutes = (int)RoundTo((decimal)(settings.RountToMinutes / 2.0), 5);
_log.Info($"Слишком много задач - уменьшаю интервал до {settings.RountToMinutes}.");
@@ -55,6 +55,7 @@ namespace JiraTimeBot.TaskTime
});
}
int remainMinutes = minutesPerWorkDay;
//Нам нужно раскидать 480 минут в день.
foreach (var taskGroup in commits.GroupBy(f => f.Branch).OrderByDescending(f=>f.Count()))
{
+146 -96
View File
@@ -30,39 +30,25 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
this.txtLog = new System.Windows.Forms.TextBox();
this.btnStart = new System.Windows.Forms.Button();
this.ntfyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.tmrStart = new System.Windows.Forms.Timer(this.components);
this.txtDummyMode = new System.Windows.Forms.CheckBox();
this.btnMeeting = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnSettings = new System.Windows.Forms.Button();
this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
this.dteForDay = new System.Windows.Forms.DateTimePicker();
this.tlpControls = new System.Windows.Forms.TableLayoutPanel();
this.txtLog = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.btnCancel = new System.Windows.Forms.Button();
this.btnMeeting = new System.Windows.Forms.Button();
this.txtDummyMode = new System.Windows.Forms.CheckBox();
this.btnStart = new System.Windows.Forms.Button();
this.pnlTopControls = new System.Windows.Forms.Panel();
this.btnDoForDate = new System.Windows.Forms.Button();
this.dteForDay = new System.Windows.Forms.DateTimePicker();
this.btnSettings = new System.Windows.Forms.Button();
this.tlpControls.SuspendLayout();
this.panel2.SuspendLayout();
this.pnlTopControls.SuspendLayout();
this.SuspendLayout();
//
// txtLog
//
this.txtLog.Location = new System.Drawing.Point(132, 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(596, 294);
this.txtLog.TabIndex = 11;
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(12, 229);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(114, 23);
this.btnStart.TabIndex = 12;
this.btnStart.Text = "Проставить время";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// ntfyIcon
//
this.ntfyIcon.Text = "notifyIcon1";
@@ -73,111 +59,175 @@
this.tmrStart.Interval = 1500;
this.tmrStart.Tick += new System.EventHandler(this.tmrStart_Tick);
//
// txtDummyMode
//
this.txtDummyMode.AutoSize = true;
this.txtDummyMode.Location = new System.Drawing.Point(12, 206);
this.txtDummyMode.Name = "txtDummyMode";
this.txtDummyMode.Size = new System.Drawing.Size(114, 17);
this.txtDummyMode.TabIndex = 13;
this.txtDummyMode.Text = "Тестовый прогон";
this.txtDummyMode.UseVisualStyleBackColor = true;
//
// btnMeeting
//
this.btnMeeting.Location = new System.Drawing.Point(12, 258);
this.btnMeeting.Name = "btnMeeting";
this.btnMeeting.Size = new System.Drawing.Size(114, 23);
this.btnMeeting.TabIndex = 14;
this.btnMeeting.Text = "Митинг";
this.btnMeeting.UseVisualStyleBackColor = true;
this.btnMeeting.Click += new System.EventHandler(this.btnMeeting_Click);
//
// btnCancel
//
this.btnCancel.Enabled = false;
this.btnCancel.Location = new System.Drawing.Point(12, 287);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(114, 23);
this.btnCancel.TabIndex = 15;
this.btnCancel.Text = "Отменить операцию";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnSettings
//
this.btnSettings.Location = new System.Drawing.Point(12, 16);
this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(114, 23);
this.btnSettings.TabIndex = 16;
this.btnSettings.Text = "Настройки";
this.btnSettings.UseVisualStyleBackColor = true;
this.btnSettings.Click += new System.EventHandler(this.btnSettings_Click);
//
// tmrUpdate
//
this.tmrUpdate.Interval = 1000;
this.tmrUpdate.Tick += new System.EventHandler(this.tmrUpdate_Tick);
//
// tlpControls
//
this.tlpControls.ColumnCount = 2;
this.tlpControls.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 150F));
this.tlpControls.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tlpControls.Controls.Add(this.txtLog, 2, 0);
this.tlpControls.Controls.Add(this.panel2, 0, 1);
this.tlpControls.Controls.Add(this.pnlTopControls, 0, 0);
this.tlpControls.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpControls.Location = new System.Drawing.Point(0, 0);
this.tlpControls.Name = "tlpControls";
this.tlpControls.RowCount = 2;
this.tlpControls.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpControls.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 200F));
this.tlpControls.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tlpControls.Size = new System.Drawing.Size(759, 416);
this.tlpControls.TabIndex = 19;
//
// txtLog
//
this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtLog.Location = new System.Drawing.Point(153, 3);
this.txtLog.Multiline = true;
this.txtLog.Name = "txtLog";
this.txtLog.ReadOnly = true;
this.tlpControls.SetRowSpan(this.txtLog, 2);
this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtLog.Size = new System.Drawing.Size(603, 410);
this.txtLog.TabIndex = 27;
//
// panel2
//
this.panel2.Controls.Add(this.btnCancel);
this.panel2.Controls.Add(this.btnMeeting);
this.panel2.Controls.Add(this.txtDummyMode);
this.panel2.Controls.Add(this.btnStart);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(3, 288);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(144, 125);
this.panel2.TabIndex = 25;
//
// btnCancel
//
this.btnCancel.Enabled = false;
this.btnCancel.Location = new System.Drawing.Point(15, 91);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(114, 23);
this.btnCancel.TabIndex = 19;
this.btnCancel.Text = "Отменить операцию";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnMeeting
//
this.btnMeeting.Location = new System.Drawing.Point(15, 62);
this.btnMeeting.Name = "btnMeeting";
this.btnMeeting.Size = new System.Drawing.Size(114, 23);
this.btnMeeting.TabIndex = 18;
this.btnMeeting.Text = "Митинг";
this.btnMeeting.UseVisualStyleBackColor = true;
this.btnMeeting.Click += new System.EventHandler(this.btnMeeting_Click);
//
// txtDummyMode
//
this.txtDummyMode.AutoSize = true;
this.txtDummyMode.Location = new System.Drawing.Point(15, 10);
this.txtDummyMode.Name = "txtDummyMode";
this.txtDummyMode.Size = new System.Drawing.Size(114, 17);
this.txtDummyMode.TabIndex = 17;
this.txtDummyMode.Text = "Тестовый прогон";
this.txtDummyMode.UseVisualStyleBackColor = true;
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(15, 33);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(114, 23);
this.btnStart.TabIndex = 16;
this.btnStart.Text = "Проставить время";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// pnlTopControls
//
this.pnlTopControls.Controls.Add(this.btnDoForDate);
this.pnlTopControls.Controls.Add(this.dteForDay);
this.pnlTopControls.Controls.Add(this.btnSettings);
this.pnlTopControls.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTopControls.Location = new System.Drawing.Point(3, 3);
this.pnlTopControls.Name = "pnlTopControls";
this.pnlTopControls.Size = new System.Drawing.Size(144, 125);
this.pnlTopControls.TabIndex = 24;
//
// btnDoForDate
//
this.btnDoForDate.Location = new System.Drawing.Point(15, 84);
this.btnDoForDate.Name = "btnDoForDate";
this.btnDoForDate.Size = new System.Drawing.Size(114, 36);
this.btnDoForDate.TabIndex = 25;
this.btnDoForDate.Text = "Проставить на дату";
this.btnDoForDate.UseVisualStyleBackColor = true;
this.btnDoForDate.Click += new System.EventHandler(this.btnDoForDate_Click);
//
// dteForDay
//
this.dteForDay.CustomFormat = "dd.MM.yyyy";
this.dteForDay.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.dteForDay.Location = new System.Drawing.Point(12, 69);
this.dteForDay.Location = new System.Drawing.Point(15, 57);
this.dteForDay.MinDate = new System.DateTime(2019, 1, 1, 0, 0, 0, 0);
this.dteForDay.Name = "dteForDay";
this.dteForDay.ShowUpDown = true;
this.dteForDay.Size = new System.Drawing.Size(113, 20);
this.dteForDay.TabIndex = 17;
this.dteForDay.Size = new System.Drawing.Size(114, 20);
this.dteForDay.TabIndex = 24;
//
// btnDoForDate
// btnSettings
//
this.btnDoForDate.Location = new System.Drawing.Point(13, 96);
this.btnDoForDate.Name = "btnDoForDate";
this.btnDoForDate.Size = new System.Drawing.Size(112, 36);
this.btnDoForDate.TabIndex = 18;
this.btnDoForDate.Text = "Проставить на дату";
this.btnDoForDate.UseVisualStyleBackColor = true;
this.btnDoForDate.Click += new System.EventHandler(this.btnDoForDate_Click);
this.btnSettings.Location = new System.Drawing.Point(15, 4);
this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(114, 23);
this.btnSettings.TabIndex = 23;
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, 320);
this.Controls.Add(this.btnDoForDate);
this.Controls.Add(this.dteForDay);
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.ClientSize = new System.Drawing.Size(759, 416);
this.Controls.Add(this.tlpControls);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2);
this.MinimumSize = new System.Drawing.Size(775, 455);
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);
this.Resize += new System.EventHandler(this.frmMain_Resize);
this.tlpControls.ResumeLayout(false);
this.tlpControls.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.pnlTopControls.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtLog;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.NotifyIcon ntfyIcon;
private System.Windows.Forms.Timer tmrStart;
private System.Windows.Forms.CheckBox txtDummyMode;
private System.Windows.Forms.Button btnMeeting;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnSettings;
private System.Windows.Forms.Timer tmrUpdate;
private System.Windows.Forms.DateTimePicker dteForDay;
private System.Windows.Forms.TableLayoutPanel tlpControls;
private System.Windows.Forms.Panel pnlTopControls;
private System.Windows.Forms.Button btnDoForDate;
private System.Windows.Forms.DateTimePicker dteForDay;
private System.Windows.Forms.Button btnSettings;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnMeeting;
private System.Windows.Forms.CheckBox txtDummyMode;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.TextBox txtLog;
}
}
+1
View File
@@ -172,6 +172,7 @@ namespace JiraTimeBot.UI
if (txtDummyMode.Checked)
{
_log.Info("Выключаем режим Тестового прогона");
txtDummyMode.Checked = false;
}
using (var tokenSource = GetTokenSource())
+26 -4
View File
@@ -49,6 +49,8 @@
this.label8 = new System.Windows.Forms.Label();
this.txtTimeControlTask = new System.Windows.Forms.TextBox();
this.chkAutostart = new System.Windows.Forms.CheckBox();
this.lblWorkDay = new System.Windows.Forms.Label();
this.txtWorkDayDuration = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label5
@@ -153,7 +155,7 @@
// chkAddComments
//
this.chkAddComments.AutoSize = true;
this.chkAddComments.Location = new System.Drawing.Point(65, 277);
this.chkAddComments.Location = new System.Drawing.Point(65, 308);
this.chkAddComments.Name = "chkAddComments";
this.chkAddComments.Size = new System.Drawing.Size(133, 17);
this.chkAddComments.TabIndex = 31;
@@ -162,7 +164,7 @@
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(86, 300);
this.btnSave.Location = new System.Drawing.Point(86, 331);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 32;
@@ -227,18 +229,36 @@
// chkAutostart
//
this.chkAutostart.AutoSize = true;
this.chkAutostart.Location = new System.Drawing.Point(65, 254);
this.chkAutostart.Location = new System.Drawing.Point(65, 285);
this.chkAutostart.Name = "chkAutostart";
this.chkAutostart.Size = new System.Drawing.Size(96, 17);
this.chkAutostart.TabIndex = 40;
this.chkAutostart.Text = "Автозагрузка";
this.chkAutostart.UseVisualStyleBackColor = true;
//
// lblWorkDay
//
this.lblWorkDay.AutoSize = true;
this.lblWorkDay.Location = new System.Drawing.Point(15, 258);
this.lblWorkDay.Name = "lblWorkDay";
this.lblWorkDay.Size = new System.Drawing.Size(117, 13);
this.lblWorkDay.TabIndex = 42;
this.lblWorkDay.Text = "Минут в рабочем дне:";
//
// txtWorkDayDuration
//
this.txtWorkDayDuration.Location = new System.Drawing.Point(133, 254);
this.txtWorkDayDuration.Name = "txtWorkDayDuration";
this.txtWorkDayDuration.Size = new System.Drawing.Size(99, 20);
this.txtWorkDayDuration.TabIndex = 41;
//
// frmSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(243, 334);
this.ClientSize = new System.Drawing.Size(243, 362);
this.Controls.Add(this.lblWorkDay);
this.Controls.Add(this.txtWorkDayDuration);
this.Controls.Add(this.chkAutostart);
this.Controls.Add(this.label8);
this.Controls.Add(this.txtTimeControlTask);
@@ -294,5 +314,7 @@
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox txtTimeControlTask;
private System.Windows.Forms.CheckBox chkAutostart;
private System.Windows.Forms.Label lblWorkDay;
private System.Windows.Forms.TextBox txtWorkDayDuration;
}
}
+9 -1
View File
@@ -38,7 +38,9 @@ namespace JiraTimeBot.UI
cboWorkType.SelectedIndex = (int) settings.WorkType;
txtTimeControlTask.Text = settings.TimeControlTask;
txtJQL.Text = settings.JiraQuery;
txtJQL.Enabled = settings.WorkType == WorkType.JiraLogs;
txtWorkDayDuration.Text = settings.MinuterPerWorkDay.ToString();
cboWorkType_SelectedIndexChanged(null, null);
}
public Settings ReadSettingsAndLock()
@@ -47,6 +49,10 @@ namespace JiraTimeBot.UI
{
roundTo = 15;
}
if (!int.TryParse(txtWorkDayDuration.Text, out var minuterPerWorkDay))
{
minuterPerWorkDay = 8 * 60;
}
var settings = new Settings
{
@@ -60,6 +66,7 @@ namespace JiraTimeBot.UI
WorkType = (WorkType) cboWorkType.SelectedIndex,
JiraQuery = txtJQL.Text,
TimeControlTask = txtTimeControlTask.Text,
MinuterPerWorkDay = minuterPerWorkDay
};
//LockUnlock(false);
@@ -87,6 +94,7 @@ namespace JiraTimeBot.UI
private void cboWorkType_SelectedIndexChanged(object sender, EventArgs e)
{
txtJQL.Enabled = (cboWorkType.SelectedIndex == 1);
txtRepoPath.Enabled = (cboWorkType.SelectedIndex == 0);
}
}
}