Exemplo n.º 1
0
        public void AddExtraTaskTime(float time)
        {
            float taskTime = (float)(Math.Ceiling((TaskWatch.Elapsed.TotalMinutes - Setting.Value.Timer_RoundUpMinutes) / 15) * .25) + (LeftoverTransfer >= 0.25f ? LeftoverTransfer : 0);

            extraTaskTime += time;
            if (taskTime + extraTaskTime < 0.0f)
            {
                extraTaskTime = -taskTime;
            }
            CalculateCurrentTaskLabel();
            for (int i = UseComboBox.Items.Count - 1; i >= 0; i--)
            {
                if (float.Parse(UseComboBox.Items[i].ToString()) > taskTime + extraTaskTime)
                {
                    UseComboBox.Items.RemoveAt(i);
                    UseComboBox.SelectedIndex = i - 1;
                    if (UseComboBox.Items.Count == 0)
                    {
                        UseComboBox.Items.Clear();
                        UseComboBox.ResetText();
                        UseComboBox.Text = "Use";
                    }
                }
            }
        }
Exemplo n.º 2
0
        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();
        }