private void ShowAlert(string Message) { MessageAlert alert = new MessageAlert(); alert.Message = Message; alert.ShowDialog(this); }
/// <summary> /// 保存操作 /// </summary> public void Save() { MessageAlert alert = new MessageAlert(); Loading ld = new Loading(); string tempText = txtTempText.Text; ((Action)(delegate() { if (LogicUser.Instance.AddUserSendTemplate(MyUserInfo.LoginToken, tempText)) { alert.Message = "保存成功"; } else { alert.Message = "保存失败"; } ld.CloseForm(); this.BeginInvoke((Action)(delegate() { MyUserInfo.sendtemplate = tempText; alert.ShowDialog(this); })); })).BeginInvoke(null, null); ld.ShowDialog(this); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddGoods_Click(object sender, EventArgs e) { MessageAlert alert = new MessageAlert(); bool isUpdate = false; if (CurrentGoods != null) { //保存商品到本地数据库 int gid = LogicGoods.Instance.SaveGoods(CurrentGoods, MyUserInfo.currentUserId, out isUpdate); if (gid > 0) { alert.Message = "保存成功!"; taskForm.LoadGoodsGridView(); } else { alert.Message = "商品采集失败!"; } } else { alert.Message = "商品采集失败"; } alert.Show(); }
private void btnUpload_Click(object sender, EventArgs e) { Button btn = sender as Button; if (btn.Tag.ToString().Equals("pic")) { if (this.openFileImage.ShowDialog() == DialogResult.OK) { txtPicPath.Text = openFileImage.FileName; } this.openFileImage.Dispose(); } else { if (this.openFileVideo.ShowDialog() == DialogResult.OK) { var ret = this.openFileVideo.SafeFileName.Split('.'); ext = ret[ret.Length - 1]; using (Stream stream = this.openFileVideo.OpenFile()) { long v = stream.Length / 1024 / 1024; if (v < 20) { this.txtVideoPath.Text = this.openFileVideo.FileName; } else { MessageAlert alert = new MessageAlert("视频文件最大不能超过20M"); alert.Show(); } } } this.openFileVideo.Dispose(); } }
private void ShowAlert(string Message, OKEventHandler handler) { MessageAlert alert = new MessageAlert(); alert.Message = Message; alert.CallBack += handler; alert.ShowDialog(this); }
/// <summary> /// 保存 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnSave_Click(object sender, EventArgs e) { MyUserInfo.filterUserGroups = txtUserfilter.Text; writeLocalFile(MyUserInfo.filterUserGroups); MessageAlert alert = new MessageAlert("保存成功"); alert.ShowDialog(this); }
/// <summary> /// 保存 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtKeyword.Text)) { txtKeyword.Focus(); return; } if (ckbAutoText.Checked) { if (string.IsNullOrEmpty(txtReplyContent.Text)) { txtReplyContent.Focus(); return; } } int flag = 0; int replyType = 0; if (ckbAutoText.Checked) { replyType = 0; } if (ckbAutoGoods.Checked) { replyType = 1; } string keyword = txtKeyword.Text; string content = txtReplyContent.Text; MessageAlert alert = new MessageAlert(); Loading ld = new Loading(); ((Action)(delegate() { flag = LogicUser.Instance.AddReplyKeyword(MyUserInfo.LoginToken, keyword, content, replyType, 0) ? 1 : 0; ld.CloseForm(); if (flag > 0) { alert.Message = "添加成功"; } else { alert.Message = "添加失败,请稍候再试!"; } this.BeginInvoke((Action)(delegate() { alert.ShowDialog(this); if (flag > 0) { hotControl.LoadDgvKeyword(); this.Close(); } })); })).BeginInvoke(null, null); ld.ShowDialog(hotForm); }
private void ShowAlert(string text) { if (this.InvokeRequired) { this.Invoke(new Action <string>(ShowAlert), new object[] { text }); } else { MessageAlert alert = new MessageAlert(text); alert.ShowDialog(this); } }
/// <summary> /// 关闭 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void pbClose_Click(object sender, EventArgs e) { if (!BuildStart) { this.Close(); } else { MessageAlert alert = new MessageAlert("正在生成发送内容,请稍后!"); alert.ShowDialog(this); } }
public void Alert(string text, string title = "提示") { if (this.InvokeRequired) { this.Invoke(new Action <string, string>(Alert), new object[] { text, title }); } else { MessageAlert alert = new MessageAlert(text, title); alert.StartPosition = FormStartPosition.CenterScreen; alert.ShowDialog(); } }
/// <summary> /// 提示 /// </summary> /// <param name="text"></param> public void AlertTip(string text) { if (this.InvokeRequired) { this.Invoke(new Action <string>(AlertTip), new object[] { text }); } else { MessageAlert alert = new MessageAlert(text, "提示"); alert.StartPosition = FormStartPosition.CenterScreen; alert.Show(); } }
/// <summary> /// 开始上传 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStartUpdate_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(sourceFileName)) { string fileName = Environment.CurrentDirectory + "\\temp\\video\\" + MyUserInfo.currentUserId.ToString(); if (!Directory.Exists(fileName)) { Directory.CreateDirectory(fileName); } fileName += "\\" + EncryptHelper.MD5(itemId) + "." + ext; File.Copy(sourceFileName, fileName, true); //TODO:将视频文件路径保存到数据库中 sourceFileName = string.Empty; MessageAlert alert = new MessageAlert("上传成功"); alert.StartPosition = FormStartPosition.CenterScreen; alert.Show(this); } }
private void btnSave_Click(object sender, EventArgs e) { MessageAlert alert = new MessageAlert(); Loading ld = new Loading(); ((Action)(delegate() { hotForm.myConfig.enable_autoremove = ckbAutoRemove.Checked ? 1 : 0; AutoRemoveUserWhereModel auto_remove_user_where = new AutoRemoveUserWhereModel(); auto_remove_user_where.enable_send_text = ckbSendMessage.Checked ? 1 : 0; auto_remove_user_where.enable_send_image = ckbSendImage.Checked ? 1 : 0; auto_remove_user_where.enable_share_card = ckbSendCard.Checked ? 1 : 0; auto_remove_user_where.enable_share_link = ckbSendLink.Checked ? 1 : 0; int result = 0; int.TryParse(txtSendImageCount.Text, out result); auto_remove_user_where.send_image_count = result > 0 ? result : 2; //发送文本的长度 int.TryParse(txtSendTextLenght.Text, out result); auto_remove_user_where.send_text_lenght = result > 0 ? result : 20; ConfigWhereModel cfgWhere = string.IsNullOrEmpty(hotForm.myConfig.where_config) ? null : JsonConvert.DeserializeObject <ConfigWhereModel>(hotForm.myConfig.where_config); cfgWhere.auto_remove_user_where = JsonConvert.SerializeObject(auto_remove_user_where); hotForm.myConfig.where_config = JsonConvert.SerializeObject(cfgWhere); int flag = LogicUser.Instance.AddUserConfigModel(MyUserInfo.LoginToken, hotForm.myConfig); ld.CloseForm(); this.BeginInvoke((Action)(delegate() //等待结束 { alert.Message = flag > 0 ? "保存成功" : "保存失败"; alert.ShowDialog(this); })); })).BeginInvoke(null, null); ld.ShowDialog(hotForm); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddGoods_Click(object sender, EventArgs e) { MessageAlert alert = new MessageAlert(); bool isUpdate = false; if (CurrentGoods != null) { try { decimal price = 0; decimal.TryParse(txtCouponPrice.Text, out price); if (price > 0) { CurrentGoods.couponPrice = price; } //保存商品到本地数据库 int gid = LogicGoods.Instance.SaveGoods(CurrentGoods, MyUserInfo.currentUserId, out isUpdate); if (gid > 0) { taskForm.LoadGoodsGridView(); Alert("保存成功!"); } else { Alert("系统繁忙,请稍后再试!"); } } catch (Exception ex) { log.Error(ex); Alert("系统繁忙,请稍后再试!"); } } else { Alert("未查找到优惠券信息!请稍后刷新再试!"); } }
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); }
public void Save() { int result = 0; decimal result2 = 0; hotForm.myConfig.userid = MyUserInfo.currentUserId; ConfigSendTimeModel cfgTime = string.IsNullOrEmpty(hotForm.myConfig.send_time_config) ? new ConfigSendTimeModel() : JsonConvert.DeserializeObject <ConfigSendTimeModel>(hotForm.myConfig.send_time_config); cfgTime = cfgTime == null ? new ConfigSendTimeModel() : cfgTime; //淘宝API cfgTime.appkey = txtTaoAppKey.Text; cfgTime.appsecret = txtTaoAppSecret.Text; //商品间隔 int.TryParse(txtgoodsinterval.Text, out result); cfgTime.goodsinterval = result < 0 ? 35 : result; //操作间隔 decimal result3 = 0; decimal.TryParse(txthandleInterval.Text, out result3); cfgTime.hdInterval = result3 == 0 ? 1 : result3; //任务间隔 int.TryParse(txtTaskInterval.Text, out result); cfgTime.taskinterval = result == 0 ? 30 : result; //图文顺序 cfgTime.imagetextsort = rbTwSort.Checked ? 0 : 1; //发送模式 cfgTime.sendmode = rdSendWindows.Checked ? 0 : 1; MyUserInfo.sendmode = cfgTime.sendmode; //过滤条件 ConfigWhereModel cfgWhere = string.IsNullOrEmpty(hotForm.myConfig.where_config) ? new ConfigWhereModel() : JsonConvert.DeserializeObject <ConfigWhereModel>(hotForm.myConfig.where_config); cfgWhere = cfgWhere == null ? new ConfigWhereModel() : cfgWhere; //优惠券过期 cfgWhere.minCouponDateDayCountEnable = ckbminCouponDayCount.Checked ? 1 : 0; int.TryParse(txtminCouponDateDayCount.Text, out result); cfgWhere.minCouponDateDayCount = result; //优惠券数量 cfgWhere.minCouponAmountEnable = ckbCoupon.Checked ? 1 : 0; int.TryParse(txtminCouponAmount.Text, out result); cfgWhere.minCouponAmount = result; //月销量 cfgWhere.minMonthSalesAmountEnable = ckbMonthSales.Checked ? 1 : 0; int.TryParse(txtminMonthSalesAmount.Text, out result); cfgWhere.minMonthSalesAmount = result; //佣金比率 cfgWhere.minCmsRateAmountEnable = ckbCmsRate.Checked ? 1 : 0; decimal.TryParse(txtminCmsRateAmount.Text, out result2); cfgWhere.minCmsRateAmount = result2; //商品价格 cfgWhere.GoodsPriceEnable = ckbGoodsPrice.Checked ? 1 : 0; decimal.TryParse(txtminGoodsPrice.Text, out result2); cfgWhere.minGoodsPrice = result2; decimal.TryParse(txtmaxGoodsPrice.Text, out result2); cfgWhere.maxGoodsPrice = result2; //过滤今日重复商品 cfgWhere.filterGoodsEnable = ckbfilterGoods.Checked ? 1 : 0; ConfigModel myConfig = hotForm.myConfig; myConfig.send_time_config = JsonConvert.SerializeObject(cfgTime); myConfig.where_config = JsonConvert.SerializeObject(cfgWhere); MessageAlert alert = new MessageAlert(); Loading ld = new Loading(); ((Action)(delegate() { if (LogicUser.Instance.AddUserConfigModel(MyUserInfo.LoginToken, hotForm.myConfig) > 0) { alert.Message = "保存成功"; } else { alert.Message = "保存失败,请重试"; } ld.CloseForm(); this.BeginInvoke((Action)(delegate() { hotForm.myConfig = myConfig; alert.ShowDialog(this); })); })).BeginInvoke(null, null); ld.ShowDialog(this); }
private void btnSave_Click(object sender, EventArgs e) { MessageAlert alert = new MessageAlert(); if (string.IsNullOrEmpty(txtTaskTitle.Text)) { alert.Message = "请输入任务标题"; alert.ShowDialog(this); txtTaskTitle.Focus(); return; } if (string.IsNullOrEmpty(txtStartTime.Text)) { txtStartTime.Focus(); return; } if (string.IsNullOrEmpty(txtEndTime.Text)) { txtEndTime.Focus(); return; } string goodsText = JsonConvert.SerializeObject(hotGoodsText); string pidsText = JsonConvert.SerializeObject(hotPidsText); TaskPlanModel model = new TaskPlanModel() { userid = MyUserInfo.currentUserId, title = txtTaskTitle.Text, startTime = Convert.ToDateTime(txtStartTime.Text), endTime = Convert.ToDateTime(txtEndTime.Text), pidsText = pidsText, goodsText = goodsText, id = taskid }; Loading ld = new Loading(); ((Action)(delegate() { //TaskPlanModel data = LogicTaskPlan.Instance.addTaskPlan(MyUserInfo.LoginToken, model); TaskPlanModel data = LogicHotTao.Instance(MyUserInfo.currentUserId).AddUserTaskPlan(model); ld.CloseForm(); if (data != null) { this.BeginInvoke((Action)(delegate() //等待结束 { if (hotTask != null) { hotTask.SetTaskView(data, taskid > 0 ? CurrentRowIndex : -1); } if (hotHistoryTask != null) { hotHistoryTask.LoadTaskPlanGridView(); } txtTaskTitle.Clear(); alert.Message = "保存成功"; alert.CallBack += () => { this.Close(); }; alert.ShowDialog(this); })); } else { this.BeginInvoke((Action)(delegate() //等待结束 { alert.Message = "保存失败"; alert.ShowDialog(this); })); } })).BeginInvoke(null, null); ld.ShowDialog(hotForm); }
/// <summary> /// 开始发送 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStartSend_Click(object sender, EventArgs e) { if (Running) { MessageAlert alert = new MessageAlert("正在发送,请稍后..."); alert.StartPosition = FormStartPosition.CenterScreen; alert.Show(); return; } List <WindowInfo> wins = WinApi.GetAllDesktopWindows(); if (wins == null || wins.Count() == 0) { MessageAlert alert = new MessageAlert("未找到聊天窗口"); alert.StartPosition = FormStartPosition.CenterScreen; alert.Show(); return; } selecctItems.Clear(); foreach (var item in lbWeChat.SelectedItems) { selecctItems.Add(item.ToString()); } if (selecctItems.Count() == 0) { MessageAlert alert = new MessageAlert("请选择发送目标"); alert.StartPosition = FormStartPosition.CenterScreen; alert.Show(); return; } string PicFilePath = txtPicPath.Text; string VideoFilePath = txtVideoPath.Text; string sendText = txtTempText.Text; if (thread != null) { thread.Abort(); thread = null; } ShowAlert("正在发送,请稍后..."); Running = true; thread = new System.Threading.Thread(() => { try { //发送图片 SendFile(wins, PicFilePath); //发送文本 SendText(wins, sendText); //发送视频文件 SendFile(wins, VideoFilePath, true); ShowAlert("发送完成"); Running = false; } catch (System.Threading.ThreadAbortException) { } catch (Exception ex) { } }); thread.IsBackground = true; thread.TrySetApartmentState(System.Threading.ApartmentState.STA); thread.Start(); }
///// <summary> ///// 记住密码 ///// </summary> //private void RememberPassword(string pwdStr) //{ // string filePath = System.IO.Path.Combine(Application.StartupPath, GlobalConfig.dbpath); // if (!Directory.Exists(filePath)) // Directory.CreateDirectory(filePath); // filePath += ConstConfig.conf_user; // if (!File.Exists(filePath)) // File.Create(filePath).Dispose(); // StreamWriter sw = new StreamWriter(@filePath, false); // sw.Write(pwdStr); // sw.Close();//写入 //} //private void ckbAutoLogin_CheckedChanged(object sender, EventArgs e) //{ // if (ckbAutoLogin.Checked) // ckbSavePwd.Checked = true; //} private void ShowAlert(string content) { MessageAlert alert = new MessageAlert(content); alert.ShowDialog(this); }
private void btnSave_Click(object sender, EventArgs e) { MessageAlert alert = new MessageAlert(); if (!isJoinImage && string.IsNullOrEmpty(txtTaskTitle.Text)) { alert.Message = "请输入任务标题"; alert.ShowDialog(this); txtTaskTitle.Focus(); return; } else { if (txtTaskTitle.Text.Length > 8) { alert.Message = "商品简述最多8个字"; alert.ShowDialog(this); txtTaskTitle.Focus(); return; } } if (string.IsNullOrEmpty(txtStartTime.Text)) { txtStartTime.Focus(); return; } if (string.IsNullOrEmpty(txtEndTime.Text)) { txtEndTime.Focus(); return; } string goodsText = JsonConvert.SerializeObject(hotGoodsText); string pidsText = JsonConvert.SerializeObject(hotPidsText); TaskPlanModel model = new TaskPlanModel() { userid = MyUserInfo.currentUserId, title = isJoinImage ? "【合成图片转发】" + txtTaskTitle.Text : txtTaskTitle.Text, startTime = Convert.ToDateTime(txtStartTime.Text), endTime = Convert.ToDateTime(txtEndTime.Text), pidsText = pidsText, goodsText = goodsText, id = taskid, status = 0, isTpwd = isJoinImage ? 1 : 0 }; Loading ld = new Loading(); ((Action)(delegate() { TaskPlanModel data = LogicHotTao.Instance(MyUserInfo.currentUserId).AddUserTaskPlan(model); if (data != null) { if (isJoinImage) { BuildText(Convert.ToInt32(data.id)); } ld.CloseForm(); this.BeginInvoke((Action)(delegate() //等待结束 { if (hotTask != null) { //hotTask.SetTaskView(data, taskid > 0 ? CurrentRowIndex : -1); hotTask.LoadTaskPlanGridView(); } txtTaskTitle.Clear(); alert.Message = "保存成功"; alert.CallBack += () => { this.Close(); }; alert.ShowDialog(this); })); } else { ld.CloseForm(); this.BeginInvoke((Action)(delegate() //等待结束 { alert.Message = "保存失败"; alert.ShowDialog(this); })); } })).BeginInvoke(null, null); ld.ShowDialog(hotForm); }