private void LabelOnClick(object sender, EventArgs eventArgs) { XPLinkLabel label = sender as XPLinkLabel; TeamProjectEntry entry = label.Tag as TeamProjectEntry; InternalCheckItem(label, !entry.Checked); if (this.chAutoApply.Checked && allowedAutoApply) { ApplyFilter(); } }
private void InternalCheckItem(XPLinkLabel label, bool @checked) { TeamProjectEntry entry = label.Tag as TeamProjectEntry; entry.Checked = @checked; this.linkToolTip.SetToolTip(label, string.Format("Click to {0} team project '{1}' {2} filter", entry.Checked ? "exclude" : "include", label.Text, entry.Checked ? "from" : "into")); label.BackColor = entry.Checked ? SystemColors.ControlLight : SystemColors.Control; label.ColorNormal = entry.Checked ? SystemColors.Highlight : SystemColors.ControlDark; }
public void CheckProject(string teamProject, bool @checked) { if (this.items.ContainsKey(teamProject)) { this.allowedAutoApply = false; try { XPLinkLabel label = this.items[teamProject]; InternalCheckItem(label, @checked); } finally { allowedAutoApply = true; } } }
public void Initialize(ControlTeamBuilds parentControl, Action <string[]> onApplyFilter) { this.parentControl = parentControl; this.OnApplyFilter = onApplyFilter; layoutPanel.Controls.Clear(); Enabled = Context.IsConnected; if (!Context.IsConnected) { return; } Dictionary <string, ProjectInfo> allProjects = Context.GetSortedProjects(); foreach (var pair in allProjects) { string projectName = pair.Key; XPLinkLabel label = new XPLinkLabel { Text = projectName }; label.Tag = new TeamProjectEntry { Project = pair.Value, Checked = false }; items.Add(projectName, label); label.ColorNormal = SystemColors.ControlDark; label.ColorHover = SystemColors.HotTrack; label.FontNormal = new Font(label.FontNormal, FontStyle.Regular); label.FontHover = new Font(label.FontHover, FontStyle.Underline); label.TransparentBackground = false; //label.BorderStyle = BorderStyle.FixedSingle; //label.AutoSize = true; label.Size = new Size(130, label.Size.Height); label.Click += LabelOnClick; layoutPanel.Controls.Add(label); linkToolTip.SetToolTip(label, string.Format("Click to include team project '{0}' into filter", projectName)); } }