public ToggleRemoveIssueButton ( bool Enable ) : void | ||
Enable | bool | |
리턴 | void |
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 (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 (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); }