Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                string userId = NickUtils.GetUserId();
                string nick   = this.nick.Text;
                string pwd    = this.pwd.Text;
                string relPwd = this.relPwd.Text;
                string qqSign = this.qqSign.Text;

                string     name   = userId;
                string     extend = Path.GetExtension(fullFileName);
                GGUserInfo user   = new GGUserInfo()
                {
                    createTime = DateTime.Now, qqSign = qqSign, userId = userId, userImg = (headImg == null ? "" : name + extend), userNickName = nick, userPwd = pwd
                };

                if (ChatDBUtils.RegisterUser(user))
                {
                    HeadImgUtils.SaveRegisterUserHeadImg(this.headImg, user);
                    MessageBox.Show(GGUserUtils.ShowNickAndId(user) + "注册成功");
                }
                else
                {
                    MessageBox.Show(GGUserUtils.ShowNickAndId(user) + "注册失败");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 初始化个人信息
 /// </summary>
 private void InitPerInfo()
 {
     this.picHeadImg.Image = HeadImgUtils.ShowHeadImg(SingleUtils.LOGINER);
     this.lblNickName.Text = GGUserUtils.GetNickAndId(SingleUtils.LOGINER);
     this.lblQQSign.Text   = SingleUtils.LOGINER.qqSign;
     this.Text             = SingleUtils.LOGINER.socket.RemoteEndPoint + "";
 }
Esempio n. 3
0
        /// <summary>
        /// 加载好友信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadFriends(object paramGroupList)
        {
            List <GGGroup> groupList        = paramGroupList as List <GGGroup>;
            string         friendsStr       = "";
            List <GGGroup> friendsGroupList = new List <GGGroup>();

            friendsList.Items.Clear();
            friendsList.Groups.Clear();
            friendsList.Columns.Clear();
            friendsList.Clear();

            friendsList.Columns.Add(null, friendsList.Width - 10);

            notifyIcon1.Text = string.Format("QQ:{0}({1})\r\n声音:{2}\r\n消息提示:{3}\r\n会话消息:{4}", SingleUtils.LOGINER.userNickName, SingleUtils.LOGINER.userId, "未开启", "开启", "头像闪烁");

            ImageList imgList = new ImageList();

            this.friendsList.LargeImageList = this.friendsList.SmallImageList = imgList; // ImageList 属性
            imgList.ImageSize = new Size(40, 40);
            if (groupList.Count > 0)
            {
                foreach (GGGroup group in groupList)
                {
                    friendsGroupList.Add(group);

                    ListViewGroup groupItem = new ListViewGroup(group.groupName + "(" + group.memberList.Count + ")");
                    this.friendsList.Groups.Add(groupItem);

                    if (!string.IsNullOrEmpty(group.members) && group.memberList.Count > 0)
                    {
                        foreach (GGUserInfo user in group.memberList)
                        {
                            ListViewItem friendItem = new ListViewItem(groupItem);
                            user.groupAutoId = group.groupAutoId;
                            //添加好友ID
                            friendsStr += user.userId + ",";
                            Image img = HeadImgUtils.ShowHeadImg(user);
                            imgList.Images.Add(user.userId, img);

                            friendItem.Tag       = user;
                            friendItem.Name      = user.userId;
                            friendItem.Font      = new Font(friendItem.Font.FontFamily, 10, FontStyle.Regular);
                            friendItem.ForeColor = Color.Black;
                            friendItem.Text      = "[" + (user.isOnLine ? "在线" : "离线") + "]" + user.userNickName + "(" + user.userId + ")" + Environment.NewLine + user.qqSign;
                            friendItem.SubItems.Add(user.userNickName);
                            friendItem.SubItems.Add(user.userId);
                            friendItem.ImageKey = user.userId;//设置头像
                            this.friendsList.Items.Add(friendItem);
                        }
                    }
                }
            }

            SingleUtils.FriendsStr       = friendsStr;
            SingleUtils.FriendsGroupList = friendsGroupList;


            this.InitMoveGroup(SingleUtils.FriendsGroupList);
        }
Esempio n. 4
0
        private void UserInfoForm_VisibleChanged(object sender, EventArgs e)
        {
            GGUserInfo user = this.Tag as GGUserInfo;

            userHeadImg.Image = HeadImgUtils.ShowHeadImg(user);
            userName.Text     = user.userNickName;
            userQm.Text       = user.qqSign;
        }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (true)
     {
         List <GGUserInfo> user = ChatDBUtils.GetAllUser();
         foreach (GGUserInfo item in user)
         {
             HeadImgUtils.SaveRegisterUserHeadImg(Image.FromFile(""), item);
         }
         MessageBox.Show("完成");
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 加载记住密码的账户信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoginForm_Load(object sender, EventArgs e)
        {
            string remPwdTxtPath = ToolUtils.GetRemPwdFile();

            string[] remPwdArr = FileUtils.ReadRemeberInfo(remPwdTxtPath);

            GGUserInfo user = new GGUserInfo()
            {
                isOnLine = true, userImg = remPwdArr[0].Split(' ')[3].ToString()
            };
            string user_userId = remPwdArr[0].Split(' ')[0].ToString(), user_userPwd = remPwdArr[0].Split(' ')[1].ToString();
            Image  user_userImg = HeadImgUtils.ShowHeadImg(user);

            for (int i = 0; i < remPwdArr.Length; i++)
            {
                string[] userItem = remPwdArr[i].Split(' ');
                string   userId   = userItem[0];
                remeberList.Add(userId);
                string userPwd      = userItem[1];
                string userNickName = userItem[2];
                string userImg      = userItem[3];
                user = new GGUserInfo()
                {
                    userId = userId, userPwd = userPwd, userNickName = userNickName, userImg = userImg, isOnLine = true
                };
                ToolStripMenuItem item = new ToolStripMenuItem();
                item.AutoSize = false;
                item.Size     = new System.Drawing.Size(182, 45);
                item.Text     = userNickName + "\n" + userId;
                item.Tag      = new string[] { userId, userPwd }; //Tag用于存储 userId 和 userPwd
                try
                {
                    item.Image = HeadImgUtils.ShowHeadImg(user);
                }
                catch (Exception)
                {
                }
                item.Click         += new EventHandler(toolStripMenuItemID_Click);
                menuStripId.Height += 45;
                menuStripId.Items.Add(item);
            }


            //显示第一项
            textBoxId.SkinTxt.Text           = user_userId;
            this.textBoxPwd.SkinTxt.Text     = user_userPwd;
            panelHeadImage.BackgroundImage   = user_userImg;
            this.checkBoxRememberPwd.Checked = true;
        }
Esempio n. 7
0
        private void btnQuery_BtnClick(object sender, EventArgs e)
        {
            Init();
            string nickorid = this.nickorid.Text.Trim();
            string sql      = @"SELECT [userAutoid]
      ,[userId]
      ,[userPwd]
      ,[userNickName]
      ,[qqSign]
      ,[userImg]
      ,[createTime]
  FROM [dbo].[GGUser]
  where (userid like '%" + nickorid + "%' or userNickName like '%" + nickorid + "%')  ";

            List <GGUserInfo> userList = DBHelper.ConvertToExtModel <GGUserInfo>(sql);

            foreach (GGUserInfo user in userList)
            {
                user.isOnLine = true;
                user.headImg  = HeadImgUtils.ShowHeadImg(user);
                if (cols > colCount)
                {
                    cols = 1;
                    ++rows;
                }
                if (user.userId == SingleUtils.LOGINER.userId)
                {
                    user.userNickName = "[自己]" + user.userNickName;
                }
                else if (SingleUtils.FriendsStr.Contains(user.userId))
                {
                    user.userNickName = "[好友]" + user.userNickName;
                }

                WinUserInfo wuInfo = new WinUserInfo(user);
                wuInfo.width  = wuInfo_width;
                wuInfo.height = wuInfo_height;

                int x = (wuInfo.width + span) * (cols - 1);
                int y = (wuInfo.height + span) * (rows - 1) + span * 3;

                wuInfo.Location = new Point(x, y);
                wuInfo.UserControlBtnAddClicked += wuInfo_UserControlBtnAddClicked;
                this.groupBox1.Controls.Add(wuInfo);

                ++cols;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 加载在线成员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ChatForm_Load(object sender, EventArgs e)
        {
            this.Size = new System.Drawing.Size(200, 200);
            this.userHeadImg.Image   = HeadImgUtils.ShowHeadImg(SingleUtils.toUser);
            this.friendNickName.Text = SingleUtils.toUser.userNickName + "(" + SingleUtils.toUser.userId + ")";
            this.friendQQSign.Text   = SingleUtils.toUser.qqSign;
            this.pictureBox1.Image   = this.userHeadImg.Image;

            SingleUtils.isQQTD = false;
            this.Width         = this.MinimumSize.Width;
            this.Height        = 700;
            this.msgContent.AppendText(SingleUtils.LOGINER.userNickName + "对" + SingleUtils.toUser.userNickName + "说:" + new Random().Next(1, 100));
            this.notifyIcon       = this.notifyIcon1.Icon;
            this.notifyIcon1.Text = string.Format("QQ:{0}({1})\r\n声音:{2}", SingleUtils.LOGINER.userNickName, SingleUtils.LOGINER.userId, "未开启");

            ShowChatForm();
        }