private void 修改备注ToolStripMenuItem_Click(object sender, EventArgs e) { UCFriendInfo ucf = (UCFriendInfo)currentRight; FrmEditFriendName fefm = new FrmEditFriendName(ucf.NickName, ucf.FID, this, this._user.userID, ucf.FriendInfo.userID); fefm.Show(); }
void ucf_MouseClick(object o, EventArgs e) { UCFriendInfo ucf = (UCFriendInfo)o; for (int i = 0; i < tbFriendTalkInfo.Count; i++) { if (tbFriendTalkInfo[i].FriendId == ucf.FriendInfo.userID) { if (tbFriendTalkInfo[i].IsOpenTalkForm) { return; } else { tbFriendTalkInfo[i].IsOpenTalkForm = true; break; } } } FrmTalk frm = new FrmTalk(tbFriendTalkInfo, this, this._user, ucf.FriendInfo, ucf.NickName); frm.Show(); }
private void 发送即时消息ToolStripMenuItem_Click(object sender, EventArgs e) { UCFriendInfo ucf = (UCFriendInfo)currentRight; for (int i = 0; i < tbFriendTalkInfo.Count; i++) { if (tbFriendTalkInfo[i].FriendId == ucf.FriendInfo.userID) { if (tbFriendTalkInfo[i].IsOpenTalkForm) { return; } else { tbFriendTalkInfo[i].IsOpenTalkForm = true; break; } } } FrmTalk frm = new FrmTalk(tbFriendTalkInfo, this, this._user, ucf.FriendInfo, ucf.NickName); frm.Show(); }
void ucF_MouseClick(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Right) { return; } currentRight = (UCFriendInfo)sender; this.menuFriend.Show(Control.MousePosition); }
private void 除好友ToolStripMenuItem_Click(object sender, EventArgs e) { UCFriendInfo ucf = (UCFriendInfo)currentRight; BLL.friendInfo bllfriend = new BLL.friendInfo(); int mf = ucf.FID; bllfriend.Delete(mf); this.panel1.Controls.Clear(); getFriendList(); }
private void getrecentfriend() { FileStream fs = new FileStream(Application.StartupPath + "\\" + "friend.txt", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); int index = 0; while (sr.Peek() > -1) { string tmp = sr.ReadLine(); string[] res = tmp.Split(' '); foreach (Model.friendInfo fri in myFriends) { if (this._user.userID == Convert.ToInt32(res[0]) && res[1] == fri.friendID.ToString()) { BLL.friendInfo bllfrq = new BLL.friendInfo(); List <Model.friendInfo> bllfq = bllfrq.GetModelList("userid=" + _user.userID + "and friendid=" + Convert.ToInt32(res[1]) + ""); UCFriendInfo ucRecentfriend = new UCFriendInfo(_user, this); BLL.userInfo frueser = new BLL.userInfo(); Model.userInfo u = frueser.GetModel(bllfq[0].friendID); ucRecentfriend.Top = ucRecentfriend.Height * index; ucRecentfriend.UserName = bllfq[0].friendName; ucRecentfriend.NickName = bllfq[0].friendName; ucRecentfriend.UserShuoshuo = u.userShuoshuo; ucRecentfriend.FriendInfo = u; ucRecentfriend.HeadImage = this.imageList1.Images[Convert.ToInt32(u.userHeadImage)]; this.pnrecentfriend.Controls.Add(ucRecentfriend); ucRecentfriend.MouseClick += new MouseEventHandler(ucf_MouseClick); //ucRecentfriend.MouseLeave += new EventHandler(ucf_MouseLeave); //ucRecentfriend.myDBClick += new UCFriendInfo.delDBClick(ucf_myDBClick); //ucRecentfriend.MouseEnter += new EventHandler(ucf_MouseEnter); index++; } } } sr.Close(); fs.Close(); }
public void getFriendList() { BLL.friendInfo bllFriend = new BLL.friendInfo(); myFriends = bllFriend.GetModelList("userID =" + this._user.userID.ToString()); int index = 0; ucflFriend.Clear(); foreach (Model.friendInfo f in myFriends) { UCFriendInfo ucF = new UCFriendInfo(); RelFriendToFrmTalk ft = new RelFriendToFrmTalk(); BLL.userInfo bllUserInfo = new BLL.userInfo(); Model.userInfo friend = bllUserInfo.GetModel(f.friendID); if (friend.userState != 2 && friend.userState != 3) { ucF.Top = ucF.Height * index; ucF.HeadImage = this.imageList1.Images[Convert.ToInt32(friend.userHeadImage)]; ucF.UserName = f.friendName; ucF.myDBClick += new UCFriendInfo.delDBClick(ucF_myDBClick); ucF.MouseClick += new MouseEventHandler(ucF_MouseClick); ucF.FriendInfo = friend; ucF.NickName = f.friendName; ucF.UserShuoshuo = friend.userShuoshuo; ucF.FID = f.ID; if (ucF.UserShuoshuo.Length >= 10) { ucF.UserShuoshuo = ucF.UserShuoshuo.Substring(0, 10) + "..."; } this.panel1.Controls.Add(ucF); index++; ft.FriendId = f.friendID; ft.IsOpenTalkForm = false; ft.Frm = null; tbFriendTalkInfo.Add(ft); ucF.UserID = f.friendID; ucflFriend.Add(ucF); } } foreach (Model.friendInfo f in myFriends) { UCFriendInfo ucF = new UCFriendInfo(); RelFriendToFrmTalk ft = new RelFriendToFrmTalk(); BLL.userInfo bllUserInfo = new BLL.userInfo(); Model.userInfo friend = bllUserInfo.GetModel(f.friendID); if (friend.userState == 2 || friend.userState == 3) { ucF.Top = ucF.Height * index; ucF.HeadImage = this.imageList1.Images[Convert.ToInt32(friend.userHeadImage) + 110]; ucF.UserName = f.friendName; ucF.myDBClick += new UCFriendInfo.delDBClick(ucF_myDBClick); ucF.MouseClick += new MouseEventHandler(ucF_MouseClick); ucF.FriendInfo = friend; ucF.NickName = f.friendName; ucF.UserShuoshuo = friend.userShuoshuo; ucF.FID = f.ID; if (ucF.UserShuoshuo.Length >= 10) { ucF.UserShuoshuo = ucF.UserShuoshuo.Substring(0, 10) + "..."; } this.panel1.Controls.Add(ucF); index++; ft.FriendId = f.friendID; ft.IsOpenTalkForm = false; ft.Frm = null; tbFriendTalkInfo.Add(ft); ucF.UserID = f.friendID; ucflFriend.Add(ucF); } } }