Esempio n. 1
0
        private void 取消全员禁言ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GroupInfoSendModel m = new GroupInfoSendModel();

            m.group_id = model.groupId;
            HttpUitls.Instance.get <BaseReciveModel>("group/cancelAllBanned", m, (json) =>
            {
                if (json.code == 200)
                {
                    model.is_all_banned = 2;
                    loadInfo();
                    EMCmdMessageBody body = new EMCmdMessageBody("");
                    EMMessage message     = EMMessage.createSendMessage(SettingMenager.shard.userID, model.groupId, body, EMChatType.GROUP);
                    message.setAttribute("type", "qun");
                    message.setAttribute("id", model.groupId);
                    message.setAttribute("grouptype", "2");
                    EaseHelper.shard.client.getChatManager().sendMessage(message);
                    HttpUitls.Instance.get <GroupInfoReciveModel>("group/detail", m, (jso) =>
                    {
                        if (jso.code == 200)
                        {
                            DBHelper.Instance.addGroupAndFocus(jso.data);
                            model = DBHelper.Instance.GetGroup(model.groupId);
                            loadInfo();
                            ThreadPool.QueueUserWorkItem((o) =>
                            {
                                refreshGroupMember();
                            });
                            MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                            if (main != null)
                            {
                                main.refreshConversationList();
                                main.loadGroup();
                            }
                        }
                        else
                        {
                            if (jso.message.Contains("重新登录"))
                            {
                                MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                                if (main != null)
                                {
                                    main.gotoLogin();
                                }
                            }
                        }
                    }, (s) =>
                    {
                        if (s < 503 && s > 500)
                        {
                            MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                            if (main != null)
                            {
                                main.gotoLogin();
                            }
                        }
                    });
                }
                else
                {
                    if (json.message.Contains("重新登录"))
                    {
                        MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                        if (main != null)
                        {
                            main.gotoLogin();
                        }
                    }
                    else
                    {
                        this.BeginInvoke(new EventHandler((s, ee) =>
                        {
                            MessageBox.Show(json.message);
                        }));
                    }
                }
            }, (code) =>
            {
                if (code < 503 && code > 500)
                {
                    MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                    if (main != null)
                    {
                        main.gotoLogin();
                    }
                }
            });
        }
Esempio n. 2
0
 private void cancelManagerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (rightIndex == -1)
     {
         return;
     }
     if (menbers != null)
     {
         var member = menbers[rightIndex];
         DeleteManagerSendModel m = new DeleteManagerSendModel();
         m.group_id      = member.user.groupID;
         m.oldManager_id = member.user.userID;
         HttpUitls.Instance.get <BaseReciveModel>("groupUser/addManager", m, (json) =>
         {
             if (json.code == 200)
             {
                 this.menbers[rightIndex].user.is_manager = 1;
                 ThreadPool.QueueUserWorkItem((o) =>
                 {
                     refreshGroupMember();
                 });
                 loadData();
                 EMCmdMessageBody body = new EMCmdMessageBody("");
                 EMMessage message     = EMMessage.createSendMessage(SettingMenager.shard.userID, member.user.userID, body, EMChatType.SINGLE);
                 message.setAttribute("type", "qun");
                 message.setAttribute("id", member.user.groupID);
                 message.setAttribute("qun_auth", "qun_auth");
                 message.setAttribute("auth", "2");
                 EaseHelper.shard.client.getChatManager().sendMessage(message);
             }
             else
             {
                 if (json.message.Contains("重新登录"))
                 {
                     MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                     if (main != null)
                     {
                         main.gotoLogin();
                     }
                 }
                 else
                 {
                     this.BeginInvoke(new EventHandler((ss, ee) =>
                     {
                         MessageBox.Show(json.message);
                     }));
                 }
             }
         }, (code) =>
         {
             if (code > 500 && code < 503)
             {
                 MainFrm main = (MainFrm)Application.OpenForms["MainFrm"];
                 if (main != null)
                 {
                     main.gotoLogin();
                 }
             }
         });
     }
     skinContextMenuStrip1.Items.Clear();
 }