private void AddUserPanel(ImageList avatarImageList, PersonSetting person) { UserPanel userPanel = new UserPanel(person, avatarImageList) { Cursor = Cursors.Hand, Visible = !person.Hidden }; userPanel.AddMouseUpToAllControls(UserPanelMouseUp); userPanel.AddMouseEnterToAllControls(UserPanelMouseEnter); _usersPanel.Controls.Add(userPanel); }
public void Initialize(SirenOfShameSettings settings, ImageList avatarImageList) { Settings = settings; var peopleByReputation = settings.People.OrderByDescending(i => i.GetReputation()); foreach (var person in peopleByReputation) { UserPanel userPanel = new UserPanel(person, avatarImageList) { Cursor = Cursors.Hand, Visible = !person.Hidden }; userPanel.AddMouseUpToAllControls(UserPanelMouseUp); userPanel.AddMouseEnterToAllControls(UserPanelMouseEnter); _usersPanel.Controls.Add(userPanel); } }
private void UserPanelMouseUp(object sender, MouseEventArgs e) { UserPanel userPanel = TraverseParentsUntilUserPanel((Control)sender); if (userPanel == null) { return; } if (e.Button == MouseButtons.Right) { _selectedRawName = userPanel.RawName; _userMenu.Show((Control)sender, e.Location); var person = _settings.FindPersonByRawName(_selectedRawName); _hiddenButton.Checked = person.Hidden; } if (e.Button == MouseButtons.Left) { InvokeOnUserSelected(userPanel.RawName); } }