Exemple #1
0
 public void update_listFriend(string _userFriend,Image _imageTemp)
 {
     if(flp_listFriend.InvokeRequired)
     {
         this.Invoke(new UpDate_listFriend_delegate(update_listFriend),_userFriend,_imageTemp);
     }
     else
     {
         Friend _friendTemp=new Friend( _userFriend,_imageTemp);
         flp_listFriend.Controls.Add(_friendTemp);
     }
 }
Exemple #2
0
        private void txt_findFriend_TextChanged(object sender, EventArgs e)
        {
            if (txt_findFriend.Text != "")
            {
                List<Control> listControls = showFindFriend.Controls.Cast<Control>().ToList();
                foreach (Control control in listControls)
                {
                    showFindFriend.Controls.Remove(control);
                    control.Dispose();
                }
                List<FriendList> listFriendtemp = new List<FriendList>();
                foreach (var s in listFriend)
                {
                    if (s._userFriend.IndexOf(txt_findFriend.Text) != -1)
                    {
                        listFriendtemp.Add(s);
                    }
                }
                if (listFriendtemp.Count == 0)
                {
                    showFindFriend.Visible = false;
                }
                else
                {
                    for (int i = 0; i < listFriendtemp.Count; i++)
                    {
                        Friend _friendTemp = new Friend(listFriendtemp[i]._userFriend, listFriendtemp[i].Image, listFriendtemp[i].Status, client, i, listFriendtemp[i].TextStatus);
                        showFindFriend.Controls.Add(_friendTemp);

                    }
                    showFindFriend.Visible = true;
                    showFindFriend.Height = listFriendtemp.Count * 50;
                }
            }
            else
            {
                showFindFriend.Visible = false;
            }
        }
Exemple #3
0
        public void update_listFriend(bool kt)
        {
            if (flp_listFriend.InvokeRequired)
            {
                this.flp_listFriend.Invoke(new UpDate_listFriend_delegate(update_listFriend), new object[] { kt });
            }
            else
            {
                if (kt)
                {
                    List<Control> listControls = flp_listFriend.Controls.Cast<Control>().ToList();
                    foreach (Control control in listControls)
                    {
                        flp_listFriend.Controls.Remove(control);
                        control.Dispose();
                    }
                }

                for (int i = 0; i < listFriend.Count; i++)
                {
                    Friend _friendTemp = new Friend(listFriend[i]._userFriend, listFriend[i].Image, listFriend[i].Status, client, i, listFriend[i].TextStatus);
                    flp_listFriend.Controls.Add(_friendTemp);

                }
            }
        }