示例#1
0
        private void AddWeChat_Load(object sender, EventArgs e)
        {
            SetAutoReplyControl   replyControl      = hotAutoForm as SetAutoReplyControl;
            SetAutoRemoveChatroom autoRemoveControl = hotAutoForm as SetAutoRemoveChatroom;
            SendMessage           sendControl       = hotAutoForm as SendMessage;

            if (hotTask == null)
            {
                hotGroupBox1.Visible  = false;
                label2.Visible        = false;
                hotGroupBox2.Location = new Point(87, 41);
                label1.Location       = new Point(29, 56);
                btnSave.Location      = new Point(93, 100);
            }

            txtWeChatTitle.Text = weChatTitle;
            txtPid.Text         = weChatPid;
            if (!string.IsNullOrEmpty(Title))
            {
                lbTitle.Text = Title;
                this.Text    = Title;
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtWeChatTitle.Text))
            {
                txtWeChatTitle.Focus();
                return;
            }
            MessageAlert alert = new MessageAlert();
            //Loading ld = new Loading();
            SetAutoReplyControl   replyControl      = hotAutoForm as SetAutoReplyControl;
            SetAutoRemoveChatroom autoRemoveControl = hotAutoForm as SetAutoRemoveChatroom;
            SendMessage           sendControl       = hotAutoForm as SendMessage;
            string groupTitle = txtWeChatTitle.Text;
            string groupPid   = txtPid.Text;

            ((Action)(delegate()
            {
                int flag = 0;
                UserWechatListModel data = new UserWechatListModel();
                if (hotTask != null)
                {
                    //data = LogicUser.Instance.UpdateUserWeChatTitle(MyUserInfo.LoginToken, editId, txtWeChatTitle.Text);

                    if (LogicHotTao.Instance(MyUserInfo.currentUserId).UpdateUserWeChatTitle(MyUserInfo.currentUserId, editId, groupTitle, groupPid))
                    {
                        data.pid = groupPid;
                        data.wechattitle = groupTitle;
                        flag = 1;
                    }
                }
                else if (replyControl != null || sendControl != null)
                {
                    flag = LogicUser.Instance.UpdateUserWeChatTitle(MyUserInfo.LoginToken, txtWeChatTitle.Text, 0);
                }
                else if (autoRemoveControl != null)
                {
                    flag = LogicUser.Instance.UpdateUserWeChatTitle(MyUserInfo.LoginToken, txtWeChatTitle.Text, 1);
                }


                if (flag > 0)
                {
                    alert.Message = "保存成功";
                }
                else
                {
                    alert.Message = "保存失败,请检查是否重复";
                }

                //ld.CloseForm();
                this.BeginInvoke((Action)(delegate()
                {
                    alert.ShowDialog(this);
                    if (flag > 0)
                    {
                        if (hotTask != null)
                        {
                            //hotTask.SetPidView(data, editId > 0 ? CurrentRowIndex : -1);
                            hotTask.loadUserPidGridView();
                        }
                        else
                        {
                            if (replyControl != null)
                            {
                                replyControl.LoadDgvChatRoom();
                                if (hotForm.wxlogin != null)
                                {
                                    hotForm.wxlogin.LoadAutoHandleData();
                                }
                            }
                            else if (autoRemoveControl != null)
                            {
                                autoRemoveControl.LoadDgvChatRoom();
                            }
                            else if (sendControl != null)
                            {
                                sendControl.LoadDgvChatRoom();
                                if (hotForm.wxlogin != null)
                                {
                                    hotForm.wxlogin.LoadAutoHandleData();
                                }
                            }
                        }
                        this.Close();
                    }
                }));
            })).BeginInvoke(null, null);
            //ld.ShowDialog(hotForm);
        }