public async Task updateUserList(List <string> onlineUsers, List <string> regUsers) { lbUsers.Items.Clear(); userList.Clear(); if (cbUsers.IsChecked == true) //true: display offline users as well as online users { //display online users first foreach (string username in onlineUsers) { regUsers.Remove(username); } foreach (string username in onlineUsers) { lbUsers.Items.Add(ListBoxUserItem.generate(lbUsers.FontSize, username, true)); userList.Add(username); } foreach (string username in regUsers) { lbUsers.Items.Add(ListBoxUserItem.generate(lbUsers.FontSize, username, false)); userList.Add(username); } //foreach (string username in onlineUsers) //{ ListBoxUserItem.add(lbUsers, username, onlineUsers.Contains(username)); userList.Add(username); } } else { foreach (string username in onlineUsers) { lbUsers.Items.Add(ListBoxUserItem.generate(lbUsers.FontSize, username, true)); userList.Add(username); } } await wrapper.updateClientUserLists(); }
public async Task updateUserList(List <string> onlineUsers) { lbUsers.Items.Clear(); userList.Clear(); foreach (string username in onlineUsers) //clients can only display other online clients. including all offline clients would probably be a violation of privacy anyway { lbUsers.Items.Add(ListBoxUserItem.generate(lbUsers.FontSize, username, true)); userList.Add(username); } }