private void ButtonAddUser_Click(object sender, EventArgs e) { if (ListBoxSource.SelectedItems.Count != 0) { List <ListBoxItem> listBoxItemList = new List <ListBoxItem>(); ListBox.SelectedObjectCollection collection = ListBoxSource.SelectedItems; if (!multipleSelect && ListBoxSelected.Items.Count > 0) { MessageBox.Show("사용자선택은 1명만 가능합니다.", "선택초과", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } foreach (ListBoxItem member in collection) { if (ListBox.NoMatches != ListBoxSelected.FindStringExact(member.Text)) { MessageBox.Show("이미 선택된 사용자 입니다.", "중복선택", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ListBoxSelected.Items.Add(member); listBoxItemList.Add(member); } } foreach (ListBoxItem obj in listBoxItemList) { ListBoxSource.Items.Remove(obj); } } }
/// <summary> /// 쪽지 수신자 추가 폼에서 "전체" 라디오 버튼 클릭시 /// </summary> private void _DisplayAllMembers() { try { SetTeamMode(false); ListBoxSource.Items.Clear(); Dictionary <string, MemberObj> membersAll = Members.GetMembers(); foreach (var de in membersAll) { if (de.Value != null) { ListBoxItem item = new ListBoxItem(de.Value); if (ListBox.NoMatches == ListBoxSelected.FindStringExact(item.Text)) { ListBoxSource.Items.Add(item); } } } } catch (Exception exception) { Logger.error(exception.ToString()); } }
/// <summary> /// 비접속자 포함 명단 다시보기 /// </summary> private void _RefreshListBoxSourceAll() { try { string teamname = (String)ComboBoxTeam.SelectedItem; if (teamname == "기타") { teamname = ""; } Dictionary <string, MemberObj> memTable = Members.GetMembersByTeam(teamname); ListBoxSource.Items.Clear(); foreach (var de in memTable) { string tempid = (String)de.Key; ListBoxItem item = new ListBoxItem(de.Value); if (ListBox.NoMatches == ListBoxSelected.FindStringExact(item.Text)) { ListBoxSource.Items.Add(item); } } } catch (Exception exception) { Logger.error(exception.ToString()); } }
/// <summary> /// 접속자 명단 다시보기 /// </summary> private void _RefreshListBoxSource() { try { string teamname = (String)ComboBoxTeam.SelectedItem; if (teamname == "기타") { teamname = ""; } Dictionary <string, MemberObj> teamMembers = Members.GetMembersByTeam(teamname); ListBoxSource.Items.Clear(); foreach (var de in teamMembers) { //string tempname = (String)de.Value; string tempId = de.Key; if (Members.ContainLoginUserNode(tempId)) { //string item = tempname + "(" + tempid + ")"; MemberObj userObj = Members.GetByUserId(tempId); ListBoxItem item = new ListBoxItem(userObj); if (ListBox.NoMatches == ListBoxSelected.FindStringExact(item.Text)) { ListBoxSource.Items.Add(item); } } } } catch (Exception exception) { Logger.error(exception.ToString()); } }
/// <summary> /// 쪽지 및 파일 전송 수신자 추가 폼에서 "접속자" 라디오 버튼 클릭시 /// </summary> private void _DisplayLoginUsers() { try { SetTeamMode(false); ListBoxSource.Items.Clear(); Dictionary <string, IPEndPoint> loginUsers = Members.GetLoginUsers(); foreach (var de in loginUsers) { if (de.Value != null) { MemberObj userObj = Members.GetByUserId(de.Key.ToString()); ListBoxItem item = new ListBoxItem(userObj); if (ListBox.NoMatches == ListBoxSelected.FindStringExact(item.Text)) { ListBoxSource.Items.Add(item); } } } } catch (Exception exception) { Logger.error(exception.ToString()); } }
private void _SetListBoxSource() { List <string> userList; if (mode == AddMemberMode.OnMemoReceived) // 전체 { userList = new List <string>(Members.GetMembers().Keys); } else //로그인사용자만 { userList = new List <string>(Members.GetLoginUsers().Keys); } foreach (string user in userList) { MemberObj userObj = Members.GetByUserId(user); if (userObj == null || userObj.Id == "") { continue; } ListBoxItem item = new ListBoxItem(userObj); if (ListBox.NoMatches == ListBoxSelected.FindStringExact(item.Text)) { ListBoxSource.Items.Add(item); } } }