public void UpdateRecentIssues() { if (Setting.Value.Timer_MaxRecentIssues == 0) { ClearRecentIssues(); } else { IssueNumberCombo.Visible = true; IssueNumber.Visible = false; IssueNumberCombo.Items.Clear(); IssueNumberCombo.Items.AddRange(TaskTracker.GetLatestIssuesNumbers(Setting.Value.Timer_MaxRecentIssues).ToArray()); } }
private void ToggleTimer() { if (!TaskWatch.IsRunning) { startToolStripMenuItem.Text = "Pause Task"; StartPauseButton.Text = ";"; StartPauseButton.Font = new Font("Webdings", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); if (!MainWatch.IsRunning) { MainWatch.Start(); } TaskWatch.Start(); AddQuarterProgress(0.0f); if (FirstStart) { TaskTracker.StartNewDay(); TaskTracker.StartNewTask(); FirstStart = false; if (TaskTracker.GetCurrentDay.TotalUsedTime != null) { AddQuarterProgress(float.Parse(TaskTracker.GetCurrentDay.TotalUsedTime)); try { MainWatch.Offset = TimeSpan.ParseExact(TaskTracker.GetCurrentDay.TotalTime, "hh\\:mm\\:ss\\.ff", CultureInfo.InvariantCulture); } catch { } } } else { if (TaskTracker.isCurrentTaskNull) { TaskTracker.StartNewTask(); } } } else { startToolStripMenuItem.Text = "Resume Task"; StartPauseButton.Text = "w"; StartPauseButton.Font = new Font("Wingdings 3", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2))); //MainWatch.Stop(); TaskWatch.Stop(); } }
public static List <string> GetAllIssues() { string[] files = Directory.GetFiles(Program.DataPath + "\\TaskData\\"); List <string> issues = new List <string>(); List <bool> toRemove = new List <bool>(); foreach (String s in files) { issues.AddRange(TaskTracker.LoadDay(s).Tasks.Select(task => task.IssueNumber)); } foreach (string s in issues) { toRemove.Add(false); } for (int i = 0; i < issues.Count; i++) { if (i < issues.Count) { for (int j = i + 1; j < issues.Count; j++) { if (issues[i] == issues[j] && i != j) { toRemove[i] = true; } } } } //Console.WriteLine(string.Join("\n", issues)); for (int i = issues.Count - 1; i >= 0; i--) { if (toRemove[i]) { issues.RemoveAt(i); } } //Console.WriteLine(string.Join("\n", issues)); return(issues); }
private void UseTime() { string IssueText = ""; if (IssueNumber.Visible) { IssueText = IssueNumber.Text.Trim(); } else { IssueText = IssueNumberCombo.Text.Trim(); } if (IssueText == "") { MessageBox.Show("You need to fill out an issue number"); return; } if (TaskTracker.isCurrentTaskNull) { TaskTracker.StartNewTask(); } if (UseComboBox.Items.Count <= 0) { return; } LeftoverTransfer = 0.0f; string sendTime = UseComboBox.SelectedItem.ToString(); if (sendTime.StartsWith(".")) { sendTime = "0" + sendTime; } float useAmount = float.Parse(sendTime); float leftover = CurrentTask - useAmount; if (leftover >= 0.25f) { Leftover += leftover; } if (Leftover > 0f) { MoveLeftOverButton.Enabled = true; } else { MoveLeftOverButton.Enabled = false; } LastTaskLabel.Text = sendTime; AddQuarterProgress(useAmount); TaskTracker.EndCurrentTask(IssueText, Task_Hour.Text + ":" + Task_Minute.Text + ":" + Task_Second.Text + "." + Task_Millisecond.Text, DateTime.Now.ToLongTimeString(), sendTime, APSCheckbox.Checked); APSCheckbox.Checked = false; RecentIssuesAutoCompleteSource.Add(IssueText); UpdateRecentIssues(); IssueNumber.Text = ""; IssueNumberCombo.Text = ""; extraTaskTime = 0.0f; UseComboBox.Items.Clear(); UseComboBox.ResetText(); UseComboBox.Text = "Use"; UseComboBox.SelectedIndex = -1; if (TaskWatch.IsRunning) { TaskWatch.Restart(); TaskTracker.StartNewTask(); } else { TaskWatch.Reset(); } SetGlobalTimer(); SetTaskTimer(); CalculateCurrentTaskLabel(); }