Example #1
0
        private void pullMsgAndDoneIt(domain.Message message)
        {
            Dictionary <string, object> map = new Dictionary <string, object>();

            map = serializeTool.Desrialize <Dictionary <string, object> >(map, message.getData());
            if (null == map)
            {
                return;
            }
            string operType = map[Grobal.USER_OPERATION].ToString();
            User   user     = (User)map[Grobal.USER];

            if (Grobal.REGIST.Equals(operType))
            {
                application.regist(user);
            }
            else if (Grobal.LOGIN.Equals(operType))
            {
                application.login(user);
            }
            else if (Grobal.LOGOUT.Equals(operType))
            {
                application.logout(user);
            }
            else if (Grobal.SENDMSG.Equals(operType))
            {
                application.sendMsg(message, (User)map[Grobal.FROM_USER]);
            }
        }
Example #2
0
        private void pullMsgAndDoneIt(domain.Message message)
        {
            Dictionary <string, object> map = new Dictionary <string, object>();

            map = serializeTool.Desrialize <Dictionary <string, object> >(map, message.getData());
            if (null == map || map.Count == 0)
            {
                return;
            }
            string operType = map[Grobal.USER_OPERATION].ToString();
            User   user     = (User)map[Grobal.USER];

            /*注册*/
            if (Grobal.REGIST.Equals(operType))
            {
                string result = map[Grobal.RESULT].ToString();
                if (Grobal.SUCCESS.Equals(result))
                {
                    this.loginForm.txt_loginName.Text = user.LoginName;
                }
                else
                {
                    MessageBox.Show("用户已存在");
                }
            }            //登录
            else if (Grobal.LOGIN.Equals(operType))
            {
                string result = map[Grobal.RESULT].ToString();
                if (Grobal.SUCCESS.Equals(result))
                {
                }
                else
                {
                    MessageBox.Show("登录名或者口令不正确!");
                }
            }
        }
 public void sendMsg(domain.Message message, User whoRev)
 {
     udpTool.send(message.getData(), whoRev.LocalPoint);
 }