private void loadFriendsIntoUI() { if (friendView.InvokeRequired) { this.Invoke(new Action(loadFriendsIntoUI)); return; } friendView.Items.Clear(); Dictionary <long, string> flist = friends.getFriends(); foreach (long k in flist.Keys) { ListViewItem lvi = friendView.Items.Add(k.ToString("x")); FriendItem f = new FriendItem(flist[k], k, lvi); f.updateItem(); friends_inUI.Add(f); f.update(); } }
private bool addNewFriend(string n, long l) { Dictionary <long, string> d = friends.getFriends(); foreach (string b in d.Values) { if (b.ToLower() == n.ToLower()) { return(false); } } d[l] = n; friends.saveFriends(d); ListViewItem lvi = friendView.Items.Add(l.ToString("x")); FriendItem f = new FriendItem(n, l, lvi); friends_inUI.Add(f); f.update(); return(true); }
private bool addNewFriend(string n, long l) { Dictionary<long, string> d = friends.getFriends(); foreach (string b in d.Values) if (b.ToLower() == n.ToLower()) return false; d[l] = n; friends.saveFriends(d); ListViewItem lvi = friendView.Items.Add(l.ToString("x")); FriendItem f = new FriendItem(n, l, lvi); friends_inUI.Add(f); f.update(); return true; }
private void loadFriendsIntoUI() { if (friendView.InvokeRequired) { this.Invoke(new Action(loadFriendsIntoUI)); return; } friendView.Items.Clear(); Dictionary<long, string> flist = friends.getFriends(); foreach (long k in flist.Keys) { ListViewItem lvi = friendView.Items.Add(k.ToString("x")); FriendItem f = new FriendItem(flist[k], k, lvi); f.updateItem(); friends_inUI.Add(f); f.update(); } }