private void BtnCommitButton_Click(object sender, EventArgs e) { bool shouldIRestart = ticking; if (projectId != 0 && issueId != 0 && activityId != 0 && ticks != 0) { ticking = false; timer1.Stop(); BtnPauseButton.Text = "Start"; if (MessageBox.Show(String.Format("Do you really want to commit the following entry: {6} Project: {0}, Activity: {1}, Issue: {2}, Date: {3}, Comment: {4}, Time: {5}", projectId, activityId, issueId, dateTimePicker1.Value.ToString("yyyy-MM-dd"), TextBoxComment.Text, String.Format("{0:0.##}", (double)ticks / 3600), Environment.NewLine), "Ready to commit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { redmine.LogTimeForIssue(projectId, issueId, TextBoxComment.Text, (double)ticks / 3600, dateTimePicker1.Value, activityId); ResetForm(); MessageBox.Show("Work logged successfully ", "Work logged", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (shouldIRestart) { ticking = true; timer1.Start(); BtnPauseButton.Text = "Pause"; } } else { if (ticks == 0) { MessageBox.Show("There is no time to log...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show("Some mandatory information is missing...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }