Esempio n. 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtSendMessage.Text))
     {
         return;
     }
     if (hotForm.wxlogin != null && !hotForm.wxlogin.isCloseWinForm)
     {
         //hotForm.wxlogin.LoadAutoHandleData();
         StartSend();
         hotForm.wxlogin.CheckActiveSendMessage();
     }
     else
     {
         MessageConfirm confirm = new MessageConfirm("您还没有微信授权,是否马上微信授权?");
         confirm.CallBack += () =>
         {
             if (hotForm.wxlogin == null)
             {
                 hotForm.wxlogin = new wxLogin(hotForm);
                 hotForm.wxlogin.ShowDialog(this);
             }
             else
             {
                 if (hotForm.wxlogin.isCloseWinForm)
                 {
                     hotForm.wxlogin.ShowWx();
                 }
             }
         };
         confirm.ShowDialog(this);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 开始转链
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStartTpwd_Click(object sender, EventArgs e)
        {
            bool           isOK    = false;
            MessageConfirm confirm = new MessageConfirm("请确保任务已经设置了PID");

            confirm.CallBack += () =>
            {
                isOK = true;
            };
            confirm.ShowDialog(this);
            if (!isOK)
            {
                return;
            }
            if (dgvTaskPlan.Rows != null)
            {
                foreach (DataGridViewRow row in dgvTaskPlan.Rows)
                {
                    ((Action)(delegate()
                    {
                        int result = 0, eCode = 0;
                        int.TryParse(row.Cells["isTpwd"].Value.ToString(), out result);
                        int.TryParse(row.Cells["ExecStatus"].Value.ToString(), out eCode);
                        if (result == 0 && eCode == 0)
                        {
                            StartTaskTpwd(row);
                        }
                    })).BeginInvoke(null, null);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 删除回复微信群
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
        private void dgvChatRoom_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewCell cell = this.dgvChatRoom.CurrentRow.Cells["deleteWechat"];

            if (cell != null && cell.ColumnIndex == e.ColumnIndex)
            {
                DataGridViewCellCollection cells = this.dgvChatRoom.CurrentRow.Cells;
                int deleteId = 0;
                int.TryParse(cells["groupid"].Value.ToString(), out deleteId);
                if (deleteId <= 0)
                {
                    ShowAlert("请选择要删除的微信群");
                    return;
                }
                MessageConfirm confirm = new MessageConfirm();
                confirm.Message   = "确认要删除该微信群吗";
                confirm.CallBack += () =>
                {
                    this.dgvChatRoom.Rows.RemoveAt(cell.RowIndex);
                    ShowAlert("删除成功");
                    ((Action)(delegate()
                    {
                        LogicUser.Instance.DeleteReplyWeChat(MyUserInfo.LoginToken, deleteId);
                    })).BeginInvoke(null, null);
                };
                confirm.ShowDialog(this);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 删除计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolsTaskDelete_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = this.dgvTaskPlan.Rows[MouseCurrentRowIndex];

            if (row != null)
            {
                int taskid = Convert.ToInt32(row.Cells["taskid"].Value);
                int eCode  = 0;
                int.TryParse(row.Cells["ExecStatus"].Value.ToString(), out eCode);
                if (eCode != 1)
                {
                    MessageConfirm confirm = new MessageConfirm("您确认要删除计划【" + taskid + "】吗?");
                    confirm.CallBack += () =>
                    {
                        LogicHotTao.Instance(MyUserInfo.currentUserId).DeleteUserTaskPlan(taskid);
                        dgvTaskPlan.Rows.Remove(row);
                    };
                    confirm.ShowDialog(this);
                }
                else
                {
                    ShowAlert("不能删除正在执行的计划");
                }
            }
            else
            {
                ShowAlert("请先选择要删除的数据行!");
            }
        }
 public void AlertConfirm(string text, Action <bool> result)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action <string>(AlertTip), new object[] { text });
     }
     else
     {
         bool           isOk  = false;
         MessageConfirm alert = new MessageConfirm(text, "提示");
         alert.StartPosition = FormStartPosition.CenterScreen;
         alert.CallBack     += () => { isOk = true; };
         alert.ShowDialog(this);
         result?.Invoke(isOk);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 一键转链
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolsTaskTpwd_Click(object sender, EventArgs e)
        {
            bool           isOK    = false;
            MessageConfirm confirm = new MessageConfirm("请确保任务已经设置了PID");

            confirm.CallBack += () =>
            {
                isOK = true;
            };
            confirm.ShowDialog(this);
            if (!isOK)
            {
                return;
            }

            DataGridViewRow row = this.dgvTaskPlan.Rows[MouseCurrentRowIndex];

            if (row != null)
            {
                int result = 0, eCode = 0;
                int.TryParse(row.Cells["isTpwd"].Value.ToString(), out result);
                int.TryParse(row.Cells["ExecStatus"].Value.ToString(), out eCode);
                if (eCode == 0)
                {
                    if (result > 0)
                    {
                        MessageConfirm confirm2 = new MessageConfirm("确定重新转链");
                        confirm2.CallBack += () =>
                        {
                            ((Action)(delegate() { StartTaskTpwd(row); })).BeginInvoke(null, null);
                        };
                        confirm2.ShowDialog(this);
                    }
                    else
                    {
                        ((Action)(delegate() { StartTaskTpwd(row); })).BeginInvoke(null, null);
                    }


                    ShowAlert("正在进行转链,请耐心等待。");
                }
                else
                {
                    ShowAlert("只对未执行的任务进行转链");
                }
            }
        }
Esempio n. 7
0
 /// <summary>
 /// 确认提示
 /// </summary>
 /// <param name="text"></param>
 /// <param name="title"></param>
 /// <param name="callback"></param>
 public void AlertConfirm(string text, string title, Action <bool> callback)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action <string, string, Action <bool> >(AlertConfirm), new object[] { text, title, callback });
     }
     else
     {
         bool           isOk  = false;
         MessageConfirm alert = new MessageConfirm(text, title);
         alert.StartPosition = FormStartPosition.CenterScreen;
         alert.CallBack     += () =>
         {
             isOk = true;
         };
         alert.ShowDialog();
         callback?.Invoke(isOk);
     }
 }
 private void picClose_Click(object sender, EventArgs e)
 {
     if (!Runing)
     {
         hotForm.collectBrowser.Dispose();
         hotForm.collectBrowser = null;
         this.Close();
     }
     else
     {
         MessageConfirm confirm = new MessageConfirm("正在进行商品采集,你确定要退出吗?");
         confirm.CallBack += () =>
         {
             hotForm.collectBrowser.Dispose();
             hotForm.collectBrowser = null;
             this.Close();
         };
         confirm.ShowDialog(this);
     }
 }
Esempio n. 9
0
        /// <summary>
        /// 删除计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolsTaskDelete_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = this.dgvTaskPlan.Rows[MouseCurrentRowIndex];

            if (row != null)
            {
                int taskid = Convert.ToInt32(row.Cells["taskid"].Value);
                int eCode  = 0;
                int.TryParse(row.Cells["ExecStatus"].Value.ToString(), out eCode);
                if (eCode != 1)
                {
                    MessageConfirm confirm = new MessageConfirm("您确认要删除计划【" + taskid + "】吗?");
                    confirm.CallBack += () =>
                    {
                        LogicHotTao.Instance(MyUserInfo.currentUserId).DeleteUserTaskPlan(taskid);
                        dgvTaskPlan.Rows.Remove(row);
                        //var taskidList = new List<GoodsTaskModel>();
                        //taskidList.Add(new GoodsTaskModel()
                        //{
                        //    id = taskid
                        //});
                        //string taskids = JsonConvert.SerializeObject(taskidList);
                        //if (LogicTaskPlan.Instance.deleteTaskPlan(MyUserInfo.LoginToken, taskids))
                        //{
                        //    dgvTaskPlan.Rows.Remove(row);
                        //}
                    };
                    confirm.ShowDialog(this);
                }
                else
                {
                    ShowAlert("不能删除正在执行的计划");
                }
            }
            else
            {
                ShowAlert("请先选择要删除的数据行!");
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 启动任务计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStartTask_Click(object sender, EventArgs e)
        {
            bool isOK = false;

            if (MyUserInfo.sendmode == 1)
            {
                if (hotForm.wxlogin == null)
                {
                    MessageConfirm confirm = new MessageConfirm("您还没有微信授权,是否马上微信授权?");
                    confirm.CallBack += () =>
                    {
                        isOK = true;
                    };
                    confirm.ShowDialog(this);
                    if (isOK)
                    {
                        hotForm.wxlogin = new wxLogin(hotForm, this);
                        hotForm.wxlogin.ShowDialog(this);
                    }
                }
                else
                {
                    if (hotForm.wxlogin.isCloseWinForm)
                    {
                        hotForm.wxlogin.ShowWx();
                    }
                    else
                    {
                        if (hotForm.wxlogin.isStartTask)
                        {
                            hotForm.wxlogin.StopWx();
                            ShowStartButtonText("启动计划");
                        }
                        else
                        {
                            hotForm.wxlogin.StartWx();
                            ShowStartButtonText("暂停计划");
                        }
                    }
                }
            }
            else
            {
                if (hotForm.winTask == null)
                {
                    MessageConfirm confirm = new MessageConfirm("是否开始执行任务?");
                    confirm.CallBack += () =>
                    {
                        isOK = true;
                    };
                    confirm.ShowDialog(this);
                    if (isOK)
                    {
                        hotForm.winTask = new StartTask(hotForm, this);
                        hotForm.winTask.OK();
                    }
                }
                else
                {
                    hotForm.winTask.isStartTask = false;
                    hotForm.winTask.Close();
                    hotForm.winTask = null;
                    ShowStartButtonText("启动计划");
                }
            }
        }