Добавлено получение данных из Jira + настройка округления

This commit is contained in:
Danil Kislov
2019-03-15 19:37:33 +03:00
parent 8cb5e1ae93
commit 09531554ea
10 changed files with 99 additions and 35 deletions
+12 -6
View File
@@ -59,6 +59,11 @@ namespace JiraTimeBotForm.UI
public Settings ReadSettingsAndLock()
{
if (!int.TryParse(txtRoundTo.Text, out var roundTo))
{
roundTo = 15;
}
var settings = new Settings
{
JiraUserName = txtJiraLogin.Text,
@@ -68,6 +73,7 @@ namespace JiraTimeBotForm.UI
RepositoryPath = txtRepoPath.Text,
DummyMode = txtDummyMode.Checked,
AddCommentsToWorklog = chkAddComments.Checked,
RountToMinutes = roundTo
};
LockUnlock(false);
@@ -119,18 +125,13 @@ namespace JiraTimeBotForm.UI
actTime.Text = settings.ActivationTime.ToString("hh\\:mm\\:ss");
txtDummyMode.Checked = settings.DummyMode;
chkAddComments.Checked = settings.AddCommentsToWorklog;
txtRoundTo.Text = settings.RountToMinutes.ToString();
}
private async void btnStart_Click(object sender, EventArgs e)
{
var settings = ReadSettingsAndLock();
if (!Directory.Exists(settings.RepositoryPath))
{
MessageBox.Show("Папка с репо не сушествует.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
using (_tokenSource = GetTokenSource())
{
await _job.DoTheJob(settings, _tasksProcessors.WorkLogTasksProcessor, _tokenSource.Token);
@@ -208,5 +209,10 @@ namespace JiraTimeBotForm.UI
{
_tokenSource.Cancel();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar);
}
}
}