Exemple #1
0
        private void btnAddTimer_Click(object sender, EventArgs e)
        {
            var addForm = new AddTimerWindow(gallifrey);

            addForm.ShowDialog();
            RefreshTimerPages();
        }
Exemple #2
0
        private void ListContextDateClicked(object sender, EventArgs e)
        {
            var menuItemSender = (MenuItem)sender;
            var selectedTimer  = GetSelectedTimer();

            var addForm = new AddTimerWindow(gallifrey);

            addForm.PreLoadJira(selectedTimer.JiraReference);

            DateTime selecteDateTime;

            if (DateTime.TryParse(menuItemSender.Text, out selecteDateTime))
            {
                addForm.PreLoadDate(selecteDateTime, true);
                if (selecteDateTime.Date == DateTime.Now.Date)
                {
                    addForm.PreLoadStartNow();
                }
            }
            else
            {
                addForm.PreLoadStartNow();
            }

            if (addForm.DisplayForm)
            {
                addForm.ShowDialog();
                RefreshInternalTimerList();
                if (addForm.NewTimerId.HasValue)
                {
                    SelectTimer(addForm.NewTimerId.Value);
                }
            }
        }
        private void btnAddTimer_Click(object sender, EventArgs e)
        {
            var selectedIssue = (JiraSearchResult) lstResults.SelectedItem;

            var addForm = new AddTimerWindow(gallifrey);
            addForm.PreLoadData(selectedIssue.JiraRef);
            addForm.ShowDialog();
            Close();
        }
Exemple #4
0
        private void btnAddTimer_Click(object sender, EventArgs e)
        {
            var selectedIssue = (JiraSearchResult)lstResults.SelectedItem;

            var addForm = new AddTimerWindow(gallifrey);

            addForm.PreLoadData(selectedIssue.JiraRef);
            addForm.ShowDialog();
            Close();
        }
 private void LoadAddTimerWindow(JiraSearchResult selectedIssue)
 {
     TopMost = false;
     var addForm = new AddTimerWindow(gallifrey);
     addForm.PreLoadJira(selectedIssue.JiraRef);
     addForm.ShowDialog();
     NewTimerId = addForm.NewTimerId;
     if (NewTimerId.HasValue)
     {
         Close();
     }
     else
     {
         DialogResult = DialogResult.None;
         TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
     }
 }
Exemple #6
0
        private void LoadAddTimerWindow(JiraSearchResult selectedIssue)
        {
            TopMost = false;
            var addForm = new AddTimerWindow(gallifrey);

            addForm.PreLoadJira(selectedIssue.JiraRef);
            addForm.ShowDialog();
            NewTimerId = addForm.NewTimerId;
            if (NewTimerId.HasValue)
            {
                Close();
            }
            else
            {
                DialogResult = DialogResult.None;
                TopMost      = gallifrey.Settings.UiSettings.AlwaysOnTop;
            }
        }
Exemple #7
0
        private void ListContextSplitClicked(object sender, EventArgs e)
        {
            var selectedTimer = GetSelectedTimer();

            var addForm = new AddTimerWindow(gallifrey);

            addForm.PreLoadDate(selectedTimer.DateStarted.Date, false);

            if (addForm.DisplayForm)
            {
                addForm.ShowDialog();
                RefreshInternalTimerList();
                if (addForm.NewTimerId.HasValue)
                {
                    var addedTimer = gallifrey.JiraTimerCollection.GetTimer(addForm.NewTimerId.Value);
                    selectedTimer.ManualAdjustment(addedTimer.CurrentTime, false);
                    SelectTimer(addForm.NewTimerId.Value);
                }
            }
        }
Exemple #8
0
        private void btnAddTimer_Click(object sender, EventArgs e)
        {
            var addForm = new AddTimerWindow(gallifrey);

            var selectedTabDate = GetSelectedTabDate();

            if (selectedTabDate.HasValue)
            {
                addForm.PreLoadDate(selectedTabDate.Value, true);
            }

            if (addForm.DisplayForm)
            {
                addForm.ShowDialog();
                RefreshInternalTimerList();
                if (addForm.NewTimerId.HasValue)
                {
                    SelectTimer(addForm.NewTimerId.Value);
                }
            }
        }
Exemple #9
0
        private void tabTimerDays_DragDrop(object sender, DragEventArgs e)
        {
            var url = GetUrl(e);

            if (!string.IsNullOrWhiteSpace(url))
            {
                var uriDrag = new Uri(url).AbsolutePath;
                var jiraRef = uriDrag.Substring(uriDrag.LastIndexOf("/") + 1);

                var selectedTabDate = GetSelectedTabDate();
                //Check if already added & if so start timer.
                if (selectedTabDate.HasValue)
                {
                    var dayTimers = gallifrey.JiraTimerCollection.GetTimersForADate(selectedTabDate.Value);
                    if (dayTimers.Any(x => x.JiraReference == jiraRef))
                    {
                        gallifrey.JiraTimerCollection.StartTimer(dayTimers.First(x => x.JiraReference == jiraRef).UniqueId);
                        RefreshInternalTimerList();
                        if (gallifrey.JiraTimerCollection.GetRunningTimerId().HasValue)
                        {
                            SelectTimer(gallifrey.JiraTimerCollection.GetRunningTimerId().Value);
                        }
                        return;
                    }
                }

                //Validate jira is real
                try
                {
                    gallifrey.JiraConnection.GetJiraIssue(jiraRef);
                }
                catch (Exception)
                {
                    MessageBox.Show(string.Format("Unable To Locate That Jira.\n\nJira Ref Dropped: '{0}'", jiraRef), "Cannot Find Jira", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                //show add form, we know it's a real jira & valid

                var addForm = new AddTimerWindow(gallifrey);
                addForm.PreLoadJira(jiraRef);

                if (selectedTabDate.HasValue)
                {
                    addForm.PreLoadDate(selectedTabDate.Value, true);
                    if (selectedTabDate.Value.Date == DateTime.Now.Date)
                    {
                        addForm.PreLoadStartNow();
                    }
                }
                else
                {
                    addForm.PreLoadStartNow();
                }

                if (addForm.DisplayForm)
                {
                    addForm.ShowDialog();
                    RefreshInternalTimerList();
                    if (addForm.NewTimerId.HasValue)
                    {
                        SelectTimer(addForm.NewTimerId.Value);
                    }
                }
            }
        }
Exemple #10
0
        private void ListContextSplitClicked(object sender, EventArgs e)
        {
            var selectedTimer = GetSelectedTimer();

            var addForm = new AddTimerWindow(gallifrey);
            addForm.PreLoadDate(selectedTimer.DateStarted.Date, false);

            if (addForm.DisplayForm)
            {
                addForm.ShowDialog();
                RefreshInternalTimerList();
                if (addForm.NewTimerId.HasValue)
                {
                    var addedTimer = gallifrey.JiraTimerCollection.GetTimer(addForm.NewTimerId.Value);
                    selectedTimer.ManualAdjustment(addedTimer.CurrentTime, false);
                    SelectTimer(addForm.NewTimerId.Value);
                }
            }
        }
Exemple #11
0
        private void ListContextDateClicked(object sender, EventArgs e)
        {
            var menuItemSender = (MenuItem)sender;
            var selectedTimer = GetSelectedTimer();

            var addForm = new AddTimerWindow(gallifrey);
            addForm.PreLoadJira(selectedTimer.JiraReference);

            DateTime selecteDateTime;
            if (DateTime.TryParse(menuItemSender.Text, out selecteDateTime))
            {
                addForm.PreLoadDate(selecteDateTime, true);
                if (selecteDateTime.Date == DateTime.Now.Date)
                {
                    addForm.PreLoadStartNow();
                }
            }
            else
            {
                addForm.PreLoadStartNow();
            }

            if (addForm.DisplayForm)
            {
                addForm.ShowDialog();
                RefreshInternalTimerList();
                if (addForm.NewTimerId.HasValue) SelectTimer(addForm.NewTimerId.Value);
            }
        }
Exemple #12
0
        private void btnAddTimer_Click(object sender, EventArgs e)
        {
            var addForm = new AddTimerWindow(gallifrey);

            var selectedTabDate = GetSelectedTabDate();
            if (selectedTabDate.HasValue)
            {
                addForm.PreLoadDate(selectedTabDate.Value, true);
            }

            if (addForm.DisplayForm)
            {
                addForm.ShowDialog();
                RefreshInternalTimerList();
                if (addForm.NewTimerId.HasValue) SelectTimer(addForm.NewTimerId.Value);
            }
        }
Exemple #13
0
        private void tabTimerDays_DragDrop(object sender, DragEventArgs e)
        {
            var url = GetUrl(e);
            if (!string.IsNullOrWhiteSpace(url))
            {
                var uriDrag = new Uri(url).AbsolutePath;
                var jiraRef = uriDrag.Substring(uriDrag.LastIndexOf("/") + 1);

                var selectedTabDate = GetSelectedTabDate();
                //Check if already added & if so start timer.
                if (selectedTabDate.HasValue)
                {
                    var dayTimers = gallifrey.JiraTimerCollection.GetTimersForADate(selectedTabDate.Value);
                    if (dayTimers.Any(x => x.JiraReference == jiraRef))
                    {
                        gallifrey.JiraTimerCollection.StartTimer(dayTimers.First(x => x.JiraReference == jiraRef).UniqueId);
                        RefreshInternalTimerList();
                        if (gallifrey.JiraTimerCollection.GetRunningTimerId().HasValue)
                        {
                            SelectTimer(gallifrey.JiraTimerCollection.GetRunningTimerId().Value);
                        }
                        return;
                    }
                }

                //Validate jira is real
                try
                {
                    gallifrey.JiraConnection.GetJiraIssue(jiraRef);
                }
                catch (Exception)
                {
                    MessageBox.Show(string.Format("Unable To Locate That Jira.\n\nJira Ref Dropped: '{0}'", jiraRef), "Cannot Find Jira", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                //show add form, we know it's a real jira & valid

                var addForm = new AddTimerWindow(gallifrey);
                addForm.PreLoadJira(jiraRef);

                if (selectedTabDate.HasValue)
                {
                    addForm.PreLoadDate(selectedTabDate.Value, true);
                    if (selectedTabDate.Value.Date == DateTime.Now.Date)
                    {
                        addForm.PreLoadStartNow();
                    }
                }
                else
                {
                    addForm.PreLoadStartNow();
                }

                if (addForm.DisplayForm)
                {
                    addForm.ShowDialog();
                    RefreshInternalTimerList();
                    if (addForm.NewTimerId.HasValue) SelectTimer(addForm.NewTimerId.Value);
                }
            }
        }
Exemple #14
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (lstLockedTimers.SelectedItems.Count == 0)
            {
                MessageBox.Show("You Must Select A Time From The List", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (lstLockedTimers.SelectedItems.Count > 1)
            {
                MessageBox.Show("Cannot Apply Action Using Multiple Timers!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var removeTimer = true;
            var idleTimer   = (IdleTimer)lstLockedTimers.SelectedItem;

            if (radSelected.Checked)
            {
                var selectedRecent = (RecentJira)cmbRecentJiras.SelectedItem;

                if (selectedRecent == null)
                {
                    MessageBox.Show("Unable To Add Time To That Jira", "Unable To Add Time", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    BindRecentTimers();
                    return;
                }

                var  timersForADate = gallifrey.JiraTimerCollection.GetTimersForADate(idleTimer.DateStarted);
                Guid timerToAddTimeTo;

                if (timersForADate.Any(x => x.JiraReference == selectedRecent.JiraReference))
                {
                    timerToAddTimeTo = timersForADate.First(x => x.JiraReference == selectedRecent.JiraReference).UniqueId;
                }
                else
                {
                    Issue jiraIssue;
                    try
                    {
                        jiraIssue = gallifrey.JiraConnection.GetJiraIssue(selectedRecent.JiraReference);
                    }
                    catch (NoResultsFoundException)
                    {
                        MessageBox.Show("Unable To Locate The Jira", "Invalid Jira", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        BindRecentTimers();
                        return;
                    }

                    timerToAddTimeTo = gallifrey.JiraTimerCollection.AddTimer(jiraIssue, idleTimer.DateStarted, new TimeSpan(), false);
                }

                gallifrey.JiraTimerCollection.AddIdleTimer(timerToAddTimeTo, idleTimer);
                NewTimerId = timerToAddTimeTo;
            }
            else if (radRunning.Checked)
            {
                gallifrey.JiraTimerCollection.AddIdleTimer(runningTimerId.Value, idleTimer);
                NewTimerId = runningTimerId;
            }
            else if (radNew.Checked)
            {
                TopMost = false;
                var addForm = new AddTimerWindow(gallifrey);
                addForm.PreLoadTime(idleTimer.IdleTimeValue);
                addForm.PreLoadDate(idleTimer.DateStarted.Date, false);
                addForm.ShowDialog();
                if (!addForm.NewTimerId.HasValue)
                {
                    removeTimer = false;
                }
                TopMost    = gallifrey.Settings.UiSettings.AlwaysOnTop;
                NewTimerId = addForm.NewTimerId;
            }
            else
            {
                removeTimer = false;
                MessageBox.Show("You Must Select An Operation When Pressing This Button", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (removeTimer)
            {
                gallifrey.IdleTimerCollection.RemoveTimer(idleTimer.UniqueId);
                Close();
            }
        }
 private void btnAddTimer_Click(object sender, EventArgs e)
 {
     var addForm = new AddTimerWindow(gallifrey);
     addForm.ShowDialog();
     RefreshTimerPages();
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (lstLockedTimers.SelectedItems.Count == 0)
            {
                MessageBox.Show("You Must Select A Time From The List", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (lstLockedTimers.SelectedItems.Count > 1)
            {
                MessageBox.Show("Cannot Apply Action Using Multiple Timers!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var removeTimer = true;
            var idleTimer = (IdleTimer)lstLockedTimers.SelectedItem;

            if (radSelected.Checked)
            {
                var selectedRecent = (RecentJira)cmbRecentJiras.SelectedItem;

                if (selectedRecent == null)
                {
                    MessageBox.Show("Unable To Add Time To That Jira", "Unable To Add Time", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    BindRecentTimers();
                    return;
                }

                var timersForADate = gallifrey.JiraTimerCollection.GetTimersForADate(idleTimer.DateStarted);
                Guid timerToAddTimeTo;

                if (timersForADate.Any(x => x.JiraReference == selectedRecent.JiraReference))
                {
                    timerToAddTimeTo = timersForADate.First(x => x.JiraReference == selectedRecent.JiraReference).UniqueId;
                }
                else
                {
                    Issue jiraIssue;
                    try
                    {
                        jiraIssue = gallifrey.JiraConnection.GetJiraIssue(selectedRecent.JiraReference);
                    }
                    catch (NoResultsFoundException)
                    {
                        MessageBox.Show("Unable To Locate The Jira", "Invalid Jira", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        BindRecentTimers();
                        return;
                    }

                    timerToAddTimeTo = gallifrey.JiraTimerCollection.AddTimer(jiraIssue, idleTimer.DateStarted, new TimeSpan(), false);
                }

                gallifrey.JiraTimerCollection.AddIdleTimer(timerToAddTimeTo, idleTimer);
                NewTimerId = timerToAddTimeTo;
            }
            else if (radRunning.Checked)
            {
                gallifrey.JiraTimerCollection.AddIdleTimer(runningTimerId.Value, idleTimer);
                NewTimerId = runningTimerId;
            }
            else if (radNew.Checked)
            {
                TopMost = false;
                var addForm = new AddTimerWindow(gallifrey);
                addForm.PreLoadTime(idleTimer.IdleTimeValue);
                addForm.PreLoadDate(idleTimer.DateStarted.Date, false);
                addForm.ShowDialog();
                if (!addForm.NewTimerId.HasValue)
                {
                    removeTimer = false;
                }
                TopMost = gallifrey.Settings.UiSettings.AlwaysOnTop;
                NewTimerId = addForm.NewTimerId;
            }
            else
            {
                removeTimer = false;
                MessageBox.Show("You Must Select An Operation When Pressing This Button", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (removeTimer)
            {
                gallifrey.IdleTimerCollection.RemoveTimer(idleTimer.UniqueId);
                Close();
            }
        }