private void EndDay() { DialogResult d = MessageBox.Show("Are you sure you want to end the day?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { TaskTracker.NullCurrentTask(); TaskTracker.EndCurrentDay(); if (MainWatch.IsRunning) { StartPauseButton_Click(null, null); } MainWatch.Reset(); TaskWatch.Reset(); CurrentTask = 0.0f; Leftover = 0.0f; LeftoverTransfer = 0.0f; Quarters = 0.0f; extraTaskTime = 0.0f; previousTaskLabel = "0.00"; LastTaskLabel.Text = "0.00"; UseComboBox.Items.Clear(); AddQuarterProgress(0.0f); FirstStart = true; StopButton.Enabled = false; StartPauseButton.Text = "w"; StartPauseButton.Font = new Font("Wingdings 3", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); SetGlobalTimer(); SetTaskTimer(); CalculateCurrentTaskLabel(); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //Removed because it should just auto-end day. If the user restarts the program, it will continue anyways /*if (StaticHandler.MainWatch.IsRunning || StaticHandler.MainWatch.ElapsedMilliseconds > 0 || !TaskTracker.isCurrentTaskNull) * { * if (e.CloseReason.Equals(CloseReason.WindowsShutDown)) * { * if (MessageBox.Show("Are you sure you want to exit without ending the current Task?", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop) != DialogResult.Yes) * e.Cancel = true; * } * else if (MessageBox.Show("Are you sure you want to exit without ending the current Task?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) * e.Cancel = true; * }*/ if (!TaskTracker.isCurrentTaskNull) { TaskTracker.NullCurrentTask(); } TaskTracker.EndCurrentDay(); Setting.Save(); CleanData.CleanJira(); if (trayIcon != null) { trayIcon.Visible = false; } }