private void checkFriendStatsbtn_Click(object sender, EventArgs e)
        {
            FriendItem  f  = GetFriendItemFromIndex(friendView.SelectedItems[0].Index);
            StatsReader sr = f.GetStatistics();

            if (sr == null)
            {
                MessageBox.Show("Could not download statistics for this player!",
                                "Retrieval error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            new FriendStats(f.Name, sr).ShowDialog();
        }
        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 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;
        }