private void IssueAdd() { this.AddCurrentIssue(); //if (this.settings.IssueCount < maxIssues || this.issueControls.Count() < maxIssues) if (this.GetCurrentPanelsIssueCount < maxIssues) { int issueCounts; this.settings.IssueCounts.TryGetValue(this.tabControl.SelectedIndex, out issueCounts); issueCounts++; this.settings.IssueCounts[this.tabControl.SelectedIndex] = issueCounts; this.InitializeIssueControls(); IssueControl AddedIssue = this.issueControls.Last(); IssueSetCurrentByControl(AddedIssue); Panel currentPanel = this.GetCurrentPanel; int currentIndex = this.tabControl.SelectedIndex; if (currentPanel != null) { currentPanel.ScrollControlIntoView(AddedIssue); this.panels[currentIndex] = currentPanel; this.tabControl.SelectedTab.Controls.Add(currentPanel); } } }
private void IssueAdd() { if (this.settings.IssueCount < maxIssues || this.issueControls.Count() < maxIssues) { this.settings.IssueCount++; this.InitializeIssueControls(); IssueControl AddedIssue = this.issueControls.Last(); IssueSetCurrentByControl(AddedIssue); this.pMain.ScrollControlIntoView(AddedIssue); } }
private void InitializeIssueControls() { this.SuspendLayout(); // If we have too many issueControl controls, compared to this.IssueCount // remove the ones not needed while (this.issueControls.Count() > this.settings.IssueCount) { var issue = this.issueControls.Last(); this.Controls.Remove(issue); } // Create issueControl controls needed while (this.issueControls.Count() < this.settings.IssueCount) { var issue = new IssueControl(this.jiraClient, this.restClientFactory); issue.TimerStarted += issue_TimerStarted; this.Controls.Add(issue); } // Position all issueControl controls and set TimerEditable int i = 0; foreach (var issue in this.issueControls) { issue.Left = 12; issue.Top = i * issue.Height + 12; issue.TimerEditable = this.settings.TimerEditable; i++; } // Resize form and reposition settings button this.ClientSize = new Size(issueControls.Last().Width + 24, this.settings.IssueCount * issueControls.Last().Height + 46); pbSettings.Left = this.ClientSize.Width - 28; pbSettings.Top = this.ClientSize.Height - 28; pbLogin.Left = 8; pbLogin.Top = this.ClientSize.Height - 28; lblConnectionHeader.Top = this.ClientSize.Height - 22; lblConnectionStatus.Top = this.ClientSize.Height - 22; lblActiveFilter.Left = this.ClientSize.Width - 320; lblActiveFilter.Top = this.ClientSize.Height - 24; cbFilters.Left = this.ClientSize.Width - 280; cbFilters.Top = this.ClientSize.Height - 28; this.TopMost = this.settings.AlwaysOnTop; this.ResumeLayout(false); this.PerformLayout(); }
private void InitializeIssueControls() { this.SuspendLayout(); // If we have too many issueControl controls, compared to this.IssueCount // remove the ones not needed while (this.issueControls.Count() > this.settings.IssueCount) { var issue = this.issueControls.Last(); this.pMain.Controls.Remove(issue); } // Create issueControl controls needed while (this.issueControls.Count() < this.settings.IssueCount) { var issue = new IssueControl(this.jiraClient, this.settings); issue.TimerStarted += issue_TimerStarted; issue.TimerReset += Issue_TimerReset; this.pMain.Controls.Add(issue); } // Position all issueControl controls and set TimerEditable int i = 0; foreach (var issue in this.issueControls) { issue.Left = 12; issue.Top = i * issue.Height + 12; i++; } pMain.Width = issueControls.Last().Width + 44; this.ClientSize = new Size(pBottom.Width, this.settings.IssueCount * issueControls.Last().Height + 50); if (this.Height > Screen.PrimaryScreen.WorkingArea.Height) { this.Height = Screen.PrimaryScreen.WorkingArea.Height; } if (this.Bottom > Screen.PrimaryScreen.WorkingArea.Height) { this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height; } pMain.Height = ClientSize.Height - 34; pBottom.Top = ClientSize.Height - 34; this.TopMost = this.settings.AlwaysOnTop; this.ResumeLayout(false); this.PerformLayout(); }
void issue_TimerStarted(object sender, EventArgs e) { IssueControl senderCtrl = (IssueControl)sender; ChangeIssueState(senderCtrl.IssueKey); if (settings.AllowMultipleTimers) return; foreach (var issue in this.issueControls) if (issue != senderCtrl) issue.Pause(); }
void issue_TimerStarted(object sender, EventArgs e) { IssueControl senderCtrl = (IssueControl)sender; foreach (var issue in this.issueControls) { if (issue != senderCtrl) { issue.Pause(); } } }
private void IssueSetCurrentByControl(IssueControl control) { int i = 0; foreach (var issue in issueControls) { if (issue == control) { IssueSetCurrent(i); return; } i++; } }
void issue_TimerStarted(object sender, EventArgs e) { if (settings.AllowMultipleTimers) { return; } IssueControl senderCtrl = (IssueControl)sender; foreach (var issue in this.issueControls) { if (issue != senderCtrl) { issue.Pause(); } } }
private void Issue_SetTracker(object sender, EventArgs e) { IssueSetCurrentByControl((IssueControl)sender); IssueControl currentIssue = (IssueControl)sender; Debug.Write("Issue_SetTracker for issue: "); waitForTimeKeepPosition = true; issueKeyForNewPosition = currentIssue.IssueKey; Debug.Write(currentIssue.IssueKey); Thread thread = Thread.CurrentThread; String msg = String.Format(" Thread ID: {0}\n", thread.ManagedThreadId); Debug.WriteLine(msg); }
private void InitializeIssueControls() { this.SuspendLayout(); if (this.settings.IssueCount >= maxIssues) { // Max reached. Reset number in case it is larger this.settings.IssueCount = maxIssues; // Update tooltip to reflect the fact that you can't add anymore // We don't disable the button since then the tooltip doesn't show but // the click won't do anything if we have too many issues this.ttMain.SetToolTip(this.pbAddIssue, string.Format("You have reached the max limit of {0} issues and cannot add another", maxIssues.ToString())); this.pbAddIssue.Cursor = System.Windows.Forms.Cursors.No; } else { if (this.settings.IssueCount < 1) { this.settings.IssueCount = 1; } // Reset status this.ttMain.SetToolTip(this.pbAddIssue, "Add another issue row (CTRL-N)"); this.pbAddIssue.Cursor = System.Windows.Forms.Cursors.Hand; } // Remove IssueControl where user has clicked the remove button foreach (IssueControl issue in this.issueControls) { if (issue.MarkedForRemoval) { this.pMain.Controls.Remove(issue); } } // If we have too many issueControl controls, compared to this.IssueCount // remove the ones not needed while (this.issueControls.Count() > this.settings.IssueCount) { var issue = this.issueControls.Last(); this.pMain.Controls.Remove(issue); } // Create issueControl controls needed while (this.issueControls.Count() < this.settings.IssueCount) { var issue = new IssueControl(this, this.jiraClient, this.settings); issue.RemoveMeTriggered += new EventHandler(this.issue_RemoveMeTriggered); issue.TimerStarted += issue_TimerStarted; issue.TimerReset += Issue_TimerReset; issue.Selected += Issue_Selected; issue.TimeEdited += Issue_TimeEdited; this.pMain.Controls.Add(issue); } // To make sure that pMain's scrollbar doesn't screw up, all IssueControls need to have // their position reset, before positioning them again foreach (IssueControl issue in this.issueControls) { issue.Left = 0; issue.Top = 0; } // Now position all issueControl controls int i = 0; bool EnableRemoveIssue = this.issueControls.Count() > 1; foreach (IssueControl issue in this.issueControls) { issue.ToggleRemoveIssueButton(EnableRemoveIssue); issue.Top = i * issue.Height; i++; } this.ClientSize = new Size(pBottom.Width, this.settings.IssueCount * issueControls.Last().Height + pMain.Top + pBottom.Height); var workingArea = Screen.FromControl(this).WorkingArea; if (this.Height > workingArea.Height) { this.Height = workingArea.Height; } if (this.Bottom > workingArea.Bottom) { this.Top = workingArea.Bottom - this.Height; } pMain.Height = ClientSize.Height - pTop.Height - pBottom.Height; pBottom.Top = ClientSize.Height - pBottom.Height; this.TopMost = this.settings.AlwaysOnTop; if (currentIssueIndex >= issueControls.Count()) { IssueSetCurrent(issueControls.Count() - 1); } else { IssueSetCurrent(currentIssueIndex); } this.ResumeLayout(false); this.PerformLayout(); UpdateIssuesOutput(true); }
private void InitializeIssueControls() { this.SuspendLayout(); // If we have too many issueControl controls, compared to this.IssueCount // remove the ones not needed while (this.issueControls.Count() > this.settings.IssueCount) { var issue = this.issueControls.Last(); this.Controls.Remove(issue); } // Create issueControl controls needed while (this.issueControls.Count() < this.settings.IssueCount) { var issue = new IssueControl(this.jiraClient); issue.TimerStarted += issue_TimerStarted; this.Controls.Add(issue); } // Position all issueControl controls and set TimerEditable int i = 0; foreach (var issue in this.issueControls) { issue.Left = 12; issue.Top = i * issue.Height + 12; issue.TimerEditable = this.settings.TimerEditable; i++; } // Resize form and reposition settings button this.ClientSize = new Size(issueControls.Last().Width + 24, this.settings.IssueCount * issueControls.Last().Height + 46); pbSettings.Left = this.ClientSize.Width - 28; pbSettings.Top = this.ClientSize.Height - 28; pbLogin.Left = 8; pbLogin.Top = this.ClientSize.Height - 28; lblConnectionHeader.Top = this.ClientSize.Height - 22; lblConnectionStatus.Top = this.ClientSize.Height - 22; lblActiveFilter.Left = this.ClientSize.Width - 320; lblActiveFilter.Top = this.ClientSize.Height - 24; cbFilters.Left = this.ClientSize.Width - 280; cbFilters.Top = this.ClientSize.Height - 28; this.TopMost = this.settings.AlwaysOnTop; this.ResumeLayout(false); this.PerformLayout(); }
private void InitializeIssueControls() { this.SuspendLayout(); if (this.settings.IssueCounts == null) { this.settings.IssueCounts = new Dictionary <int, int>(); this.AddCurrentIssue(1); } if (this.GetCurrentPanelsIssueCount >= maxIssues) { // Max reached. Reset number in case it is larger this.settings.IssueCounts[this.tabControl.SelectedIndex] = maxIssues; // Update tooltip to reflect the fact that you can't add anymore // We don't disable the button since then the tooltip doesn't show but // the click won't do anything if we have too many issues this.ttMain.SetToolTip(this.pbAddIssue, string.Format("You have reached the max limit of {0} issues and cannot add another", maxIssues.ToString())); this.pbAddIssue.Cursor = System.Windows.Forms.Cursors.No; } else { //if (this.GetCurrentPanelsIssueCount < 1) //{ // this.settings.IssueCounts[this.tabControl.SelectedIndex] = 1; //} // Reset status this.ttMain.SetToolTip(this.pbAddIssue, "Add another issue row (CTRL-N)"); this.pbAddIssue.Cursor = System.Windows.Forms.Cursors.Hand; } int count = this.tabControl.TabCount; int currentIndex = this.tabControl.SelectedIndex; if (this.panels == null) { this.GetPanel(0); } Panel currentPanel = this.GetCurrentPanel; // Remove IssueControl where user has clicked the remove button foreach (IssueControl issue in this.issueControls) { if (issue.MarkedForRemoval) { if (currentPanel != null) { currentPanel.Controls.Remove(issue); this.panels[currentIndex] = currentPanel; this.tabControl.SelectedTab.Controls.Add(currentPanel); } } } // In case a new tab was added but no issue were assigned int res; bool hasValue = this.settings.IssueCounts.TryGetValue(this.tabControl.SelectedIndex, out res); if (!hasValue) { this.AddCurrentIssue(); } // If we have too many issueControl controls, compared to this.IssueCount // remove the ones not needed while (this.GetCurrentPanelsIssueCount > this.settings.IssueCounts[this.tabControl.SelectedIndex]) { var issue = this.issueControls.Last(); currentPanel.Controls.Remove(issue); } // Create issueControl controls needed while (this.GetCurrentPanelsIssueCount < this.settings.IssueCounts[this.tabControl.SelectedIndex]) { var issue = new IssueControl(this, this.jiraClient, this.settings); issue.RemoveMeTriggered += new EventHandler(this.issue_RemoveMeTriggered); issue.TimerStarted += issue_TimerStarted; issue.TimerReset += Issue_TimerReset; issue.Selected += Issue_Selected; issue.TimeEdited += Issue_TimeEdited; currentPanel.Controls.Add(issue); } // To make sure that pMain's scrollbar doesn't screw up, all IssueControls need to have // their position reset, before positioning them again foreach (IssueControl issue in this.issueControls) { issue.Left = 0; issue.Top = 0; } // Now position all issueControl controls int i = 0; bool EnableRemoveIssue = this.issueControls.Count() > 1; foreach (IssueControl issue in this.issueControls) { issue.ToggleRemoveIssueButton(EnableRemoveIssue); issue.Top = i * issue.Height; i++; } int panelWithMostIssuesCount = this.GetPanelWithHighestIssueCount; this.ClientSize = new Size(pBottom.Width, 25 + (panelWithMostIssuesCount * issueControls.Last().Height + tabControl.Top + pBottom.Height)); this.panels[currentIndex] = currentPanel; var workingArea = Screen.FromControl(this).WorkingArea; if (this.Height > workingArea.Height) { this.Height = workingArea.Height; } if (this.Bottom > workingArea.Bottom) { this.Top = workingArea.Bottom - this.Height; } tabControl.Height = (ClientSize.Height - pTop.Height - pBottom.Height + 5); this.tabControl.SelectedTab.Controls.Add(currentPanel); pBottom.Top = (ClientSize.Height - pBottom.Height); this.TopMost = this.settings.AlwaysOnTop; if (this.GetCurrentTabIssueIndex() >= issueControls.Count()) { IssueSetCurrent(issueControls.Count() - 1); } else { IssueSetCurrent(this.GetCurrentTabIssueIndex()); } this.ResumeLayout(false); this.PerformLayout(); UpdateIssuesOutput(true); }
private void InitializeIssueControls() { this.SuspendLayout(); if (this.settings.IssueCount >= maxIssues) { // Max reached. Reset number in case it is larger this.settings.IssueCount = maxIssues; // Update tooltip to reflect the fact that you can't add anymore // We don't disable the button since then the tooltip doesn't show but // the click won't do anything if we have too many issues this.ttMain.SetToolTip(this.pbAddIssue, string.Format("You have reached the max limit of {0} issues and cannot add another", maxIssues.ToString())); this.pbAddIssue.Cursor = System.Windows.Forms.Cursors.No; } else { if (this.settings.IssueCount < 1) this.settings.IssueCount = 1; // Reset status this.ttMain.SetToolTip(this.pbAddIssue, "Add another issue row"); this.pbAddIssue.Cursor = System.Windows.Forms.Cursors.Hand; } // Remove IssueControl where user has clicked the remove button foreach (IssueControl issue in this.issueControls) { if (issue.MarkedForRemoval) this.pMain.Controls.Remove(issue); } // If we have too many issueControl controls, compared to this.IssueCount // remove the ones not needed while (this.issueControls.Count() > this.settings.IssueCount) { var issue = this.issueControls.Last(); this.pMain.Controls.Remove(issue); } // Create issueControl controls needed while (this.issueControls.Count() < this.settings.IssueCount) { var issue = new IssueControl(this.jiraClient, this.settings); issue.RemoveMeTriggered += new EventHandler(this.issue_RemoveMeTriggered); issue.TimerStarted += issue_TimerStarted; issue.TimerReset += Issue_TimerReset; this.pMain.Controls.Add(issue); } // To make sure that pMain's scrollbar doesn't screw up, all IssueControls need to have // their position reset, before positioning them again foreach (IssueControl issue in this.issueControls) { issue.Left = 0; issue.Top = 0; } // Now position all issueControl controls int i = 0; bool EnableRemoveIssue = this.issueControls.Count() > 1; foreach (IssueControl issue in this.issueControls) { issue.ToggleRemoveIssueButton(EnableRemoveIssue); issue.Top = i * issue.Height; i++; } this.ClientSize = new Size(pBottom.Width, this.settings.IssueCount * issueControls.Last().Height + pMain.Top + pBottom.Height); if (this.Height > Screen.PrimaryScreen.WorkingArea.Height) this.Height = Screen.PrimaryScreen.WorkingArea.Height; if (this.Bottom > Screen.PrimaryScreen.WorkingArea.Height) this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height; pMain.Height = ClientSize.Height - pTop.Height - pBottom.Height; pBottom.Top = ClientSize.Height - pBottom.Height; this.TopMost = this.settings.AlwaysOnTop; this.ResumeLayout(false); this.PerformLayout(); UpdateIssuesOutput(true); }
public void HandleSessionUnlock() { if (settings.PauseOnSessionLock != PauseAndResumeSetting.PauseAndResume) return; if (lastRunningIssue != null) { lastRunningIssue.InvokeIfRequired( () => lastRunningIssue.Start() ); lastRunningIssue = null; } }
public void HandleSessionLock() { if (settings.PauseOnSessionLock == PauseAndResumeSetting.NoPause) return; foreach (var issue in issueControls) { if (issue.WatchTimer.Running) { lastRunningIssue = issue; issue.InvokeIfRequired( () => issue.Pause() ); return; } } }