Exemplo n.º 1
0
 //拉取群离线消息
 public void pullGroupOfflineMsg(string gid)
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "offlinemsg?protocol=2&gid=" + gid, delegate(string groupOfflineMsg)
     {
         Debug.Print(gid + "的群离线消息------>>>>>>" + groupOfflineMsg);
         MsgModel[] groupOfflineMsgArr = null;
         //  MessageBox.Show("MsgMgr.pullOfflineMsg()解析离线消息" + offlineMsg);
         try
         {
             groupOfflineMsgArr = Coding <MsgModel[]> .decode(groupOfflineMsg);
         }
         catch (Exception e)
         {
             Debug.Print("MsgMgr.pullOfflineMsg()解析群组离线消息失败" + e.ToString());
             //       MessageBox.Show("MsgMgr.pullOfflineMsg()解析离线消息失败" + e.ToString());
         }
         //处理离线消息
         if (groupOfflineMsgArr != null)
         {
             foreach (var item in groupOfflineMsgArr)
             {
                 MainMgr.Instance.msgMgr.onNewMessage(item);
             }
             Debug.Print("群离线消息数量:" + groupOfflineMsgArr.Length);
         }
     });
 }
Exemplo n.º 2
0
 //拉取或刷新群成员列表
 public void refreshMembers(string groupId)
 {
     //拉取群成员
     HttpReqHelper.requestSync(AppConst.WebUrl + "groupMembers?gid=" + groupId, delegate(string membersJson)
     {
         //先清空
         clearMemberSafePost();
         //   Debug.Print("收到群成员是:" + membersJson);
         GroupMembers members = Coding <GroupMembers> .decode(membersJson);
         //    Debug.Print("群主是:" + members.Master);
         GroupMember master = new GroupMember(members.Master, 2);
         addMemberSafePost(master);
         //     Debug.Print("管理是:" + members.Manager);
         string[] mans = members.Manager.Split(',');
         foreach (var item in mans)
         {
             if (item != "")
             {
                 //  GroupMember manger = new GroupMember(item,1);
                 //  addMemberSafePost(manger);
             }
         }
         //  Debug.Print("成员是:" + members.Member);
         string[] mems = members.Member.Split(',');
         foreach (var item in mems)
         {
             if (item != "")
             {
                 GroupMember member = new GroupMember(item, 0);
                 addMemberSafePost(member);
             }
         }
     });
 }
Exemplo n.º 3
0
        //保存修改按钮
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (this.textBoxNickName.Text != oldNickName || this.textBoxDisc.Text != oldBoxDisc)
            {
                string url = AppConst.WebUrl + "groupBaseInfo?protocol=" + HttpGroupProtocol.MODIFY_GROUP_BASE_INFO + "&gid=" + m_groupModel.Gid + "&name=" + this.textBoxNickName.Text + "&description=" + this.textBoxDisc.Text;
//                Debug.Print(url);
                HttpReqHelper.requestSync(url, delegate(string result)
                {
                    if (result == "true")
                    {
                        //修改模型
                        m_groupModel.Name        = this.textBoxNickName.Text;
                        m_groupModel.Description = this.textBoxDisc.Text;
                        m_FormShowGroupInfo.refreshSafePost(m_groupModel);
                        ////广播最新的群模型给所有群员
                        //string message = Coding<GroupInfoModel>.encode(m_groupModel);
                        //NetWorkManager.Instance.sendMessage(Protocol.SETTING, -1, 0, message);
                        saveOKSafePost();
                    }
                    else
                    {
                        Debug.Print("修改失败");
                    }
                });
            }
        }
Exemplo n.º 4
0
        //保存修改按钮
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (this.textBoxNickName.Text != oldNickName || this.textBoxDisc.Text != oldBoxDisc)
            {
                string url = AppConst.WebUrl + "baseInfo?protocol=" + HttpPersonalProtocol.MODIFY_BASE_INFO + "&username="******"&nickname=" + this.textBoxNickName.Text + "&description=" + this.textBoxDisc.Text;
//                Debug.Print(url);
                HttpReqHelper.requestSync(url, delegate(string result)
                {
                    //收到修改后的个人信息模型
                    if (result == "true")
                    {
                        //修改模型 //修改模型将会发出事件
                        PersonalInfoModel newModel = new PersonalInfoModel();
                        newModel.Username          = AppInfo.PERSONAL_INFO.Username;
                        newModel.Nickname          = this.textBoxNickName.Text;
                        newModel.Description       = this.textBoxDisc.Text;
                        newModel.Face         = AppInfo.PERSONAL_INFO.Face;
                        AppInfo.PERSONAL_INFO = newModel;
                        saveOKSafePost();
                    }
                    else
                    {
                        Debug.Print("修改失败");
                    }
                });
            }
        }
Exemplo n.º 5
0
        //查找好友TODO:字符过滤
        private void buttonFindFriend_Click(object sender, EventArgs e)
        {
            if (textBoxFindFriend.Text == "")
            {
                showOpreationResultSafePost("输入不能为空。");
                return;
            }
            if (textBoxFindFriend.Text == AppInfo.USER_NAME)
            {
                showOpreationResultSafePost("不可以添加自己。");
                return;
            }

            if (textBoxFindFriend.Text != "")
            {
                this.flowLayoutPanelStrangers.Controls.Clear();
                HttpReqHelper.requestSync(AppConst.WebUrl + "findFriend?username=" + textBoxFindFriend.Text, delegate(string friends) {
                    try
                    {
                        PersonalInfoModel[] model = Coding <PersonalInfoModel[]> .decode(friends);
                        foreach (var item in model)
                        {
                            AddFriendItem otherItem = new AddFriendItem(item.Username, item.Nickname, item.Face);
                            // this.flowLayoutPanelStrangers.Controls.Add(otherItem);
                            addItemSafePost(otherItem);
                        }
                    }
                    catch (Exception)
                    {
                    }
                });
            }
        }
Exemplo n.º 6
0
 public void refreshMembers(int groupId)
 {
     this.flowLayoutPanelMembers.Controls.Clear();
     //拉取群成员
     HttpReqHelper.requestSync(AppConst.WebUrl + "groupMembers?gid=" + groupId, delegate(string membersJson) {
         m_SyncContext.Post(addMemberItem, membersJson);
     });
 }
Exemplo n.º 7
0
 void clearOfflineMsg()
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "offlinemsg?protocol=1&username="******"false")
         {
             clearOfflineMsg();
         }
     });
 }
Exemplo n.º 8
0
        //任务完成
        public void missionOK()
        {
            mainform.showLog("任务完成,重新询问任务...");
            //通知服务器完成任务
            string code = buildModel.Filename.Substring(0, buildModel.Filename.IndexOf('.'));

            HttpReqHelper.requestSync(AppConst.WebUrl + "buildHelper?protocol=2&fbx=" + code, delegate(string res)
            {
                Thread.Sleep(3000);
                // MessageBox.Show("任务完成,重新询问任务");
                ask();
            });
        }
Exemplo n.º 9
0
 void pullFriendList()
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "friendList?username="******"我的好友列表------>>>>>>" + pullFriendList);
         string[] friendArr = pullFriendList.Split(',');
         foreach (var friend in friendArr)
         {
             if (friend != "")
             {
                 addFriendItemSafePost(friend);
             }
         }
     });
 }
Exemplo n.º 10
0
 //需要群主验证被勾选
 private void checkBoxVerifymode2_Click(object sender, EventArgs e)
 {
     if (checkBoxVerifymode2.Checked == true)
     {
         //发送请求
         HttpReqHelper.requestSync(AppConst.WebUrl + "groupBaseInfo?protocol=3&gid=" + m_groupItem.getGroupMode().Gid + "&method=0", delegate(string result){
             if (result == "true")
             {
                 setEnterMethodSafePost(0);
             }
         });
     }
     else
     {
         checkBoxVerifymode2.Checked = true;
     }
 }
Exemplo n.º 11
0
 //确认按钮
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (!IsPsdRightFormat(textBox1.Text))
     {
         MessageBox.Show("新密码的格式不正确!");
         return;
     }
     HttpReqHelper.requestSync(AppConst.WebUrl + "forgetPsd?protocol=2&acc=" + acc + "&psd=" + textBox1.Text, delegate(string callback)
     {
         if (callback == "true")
         {
             closeFormSafePost();
         }
         else
         {
             MessageBox.Show("密码修改失败!", "提示:");
         }
     });
 }
Exemplo n.º 12
0
 void ask()
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "buildHelper?protocol=1", delegate(string res)
     {
         try
         {
             buildModel = Coding <BuildModel> .decode(res);
             mainform.clearLogSafePost();
             mainform.showLogSafePost("开始执行任务:" + buildModel.Filename + "   " + buildModel.Name);
             startMissionSafePost();
         }
         catch (Exception err)
         {
             mainform.showLogSafePost(res + "  " + err.ToString());
             mainform.showLogSafePost("暂无任务...");
             Thread.Sleep(3000);
             ask();
         }
     });
 }
Exemplo n.º 13
0
 public FormForget2(int x, int y, string _acc)
 {
     acc = _acc;
     InitializeComponent();
     m_SyncContext      = SynchronizationContext.Current;
     this.StartPosition = FormStartPosition.Manual;
     this.Location      = (Point) new Size(x, y);
     //拉取账号关联的电话号
     Debug.Print(acc + AppConst.WebUrl + "forgetPsd?protocol=1&acc=" + acc);
     HttpReqHelper.requestSync(AppConst.WebUrl + "forgetPsd?protocol=1&acc=" + acc, delegate(string callback)
     {
         if (callback != "" && callback != "error")
         {
             phoneNum = callback;
             SetPhonetipSafePost("提示:" + phoneNum.Substring(0, 4) + "*******");
         }
         else
         {
             MessageBoxSafePost("此账号不存在!请核对后重试");
         }
     });
 }
Exemplo n.º 14
0
 //拉取群列表
 void pullGroupList()
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "groupList?username="******"我的群列表------>>>>>>" + pullGroupList);
         if (pullGroupList == "")
         {
             return;
         }
         try
         {
             MyGroupModel[] myGroupModels = Coding <MyGroupModel[]> .decode(pullGroupList);
             foreach (var group in myGroupModels)
             {
                 addItemSafePost(group);
             }
         }
         catch (Exception e)
         {
             Debug.Print(e.ToString());
         }
     });
 }
Exemplo n.º 15
0
        //拉取离线消息
        void pullOfflineMsg()
        {
            HttpReqHelper.requestSync(AppConst.WebUrl + "offlinemsg?protocol=0&username="******"我的离线消息------>>>>>>" + offlineMsg);
                //  MessageBox.Show("MsgMgr.pullOfflineMsg()解析离线消息" + offlineMsg);
                try
                {
                    offlineMsgArr = Coding <MsgModel[]> .decode(offlineMsg);
                }
                catch (Exception e)
                {
                    Debug.Print("MsgMgr.pullOfflineMsg()解析离线消息失败" + e.ToString());
                    //       MessageBox.Show("MsgMgr.pullOfflineMsg()解析离线消息失败" + e.ToString());
                }



                //处理离线消息
                if (offlineMsgArr != null)
                {
                    foreach (var item in MainMgr.Instance.msgMgr.offlineMsgArr)
                    {
                        MainMgr.Instance.msgMgr.onNewMessage(item);
                    }
                }



                //告诉服务器可以删除离线消息
                if (offlineMsgArr != null)
                {
                    if (offlineMsgArr.Length > 0)
                    {
                        clearOfflineMsg();
                    }
                }
            });
        }