private void _groupManager_ChampionList_NameChanged(ChampionList sender, EventArgs e) { if (sender != null) { int indexOfSender = _gm.indexOf(sender.getName()); //if indexOfSender != -1 update that specific group if (indexOfSender != -1) { System.Windows.Controls.CheckBox chk = new System.Windows.Controls.CheckBox(); chk = (System.Windows.Controls.CheckBox)cboGroups.Items.GetItemAt(indexOfSender); chk.Content = sender.getName(); cboGroups.UpdateLayout(); } } }
/// <summary> /// Add a new group. /// </summary> /// <exception cref="ArgumentExcception">Throws an ArgumentException if the group name is not unique.</exception> public void AddGroup(ChampionList newGroup) { if (lstGroupList.Count < intMaxGroups) { foreach (ChampionList item in lstGroupList) { if (item.getName().Equals(newGroup.getName())) { throw new ArgumentException("Name duplicate!"); } } lstGroupList.Add(newGroup); if (GroupsChanged != null) { GroupsChanged(this, new GroupManagerEventArgs(GroupManagerEventOperation.Add, newGroup)); } } }