private void btnSearch_Click(object sender, EventArgs e) { if (BgWait1.IsBusy == false) { page.CurrentPage = 1; BgWait1.RunWorkerAsync("SearchData"); } }
/// <summary> /// 上一页以及下一页的跳转功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridViewPaging1_PagingChanged(object sender, MyPagingEventArgs e) { if (BgWait1.IsBusy == false) { gridControl1.RefreshDataSource(); BgWait1.RunWorkerAsync("SearchData"); } }
/// <summary> /// barManager控件响应事件,打开新窗体,传入参数区分新增跟修改,等待窗体数据返回更新列表数据 /// lastupdata:20161115XXQ /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { frmExecute AddExetue = null; strDeviCode = null; if (BgWait1.IsBusy == false) { switch (e.Item.Name) { case "bbtniAdd": AddExetue = new frmExecute(context, strDeviCode); if (AddExetue.ShowDialog() == DialogResult.OK) { BgWait1.RunWorkerAsync("SearchData"); } break; case "bbtniUpdate": if (gridView1.FocusedRowHandle >= 0) { var model1 = gridView1.GetRow(gridView1.FocusedRowHandle) as SRExcute.DeviceExecute; AddExetue = new frmExecute(context, model1.DeviCode); if (AddExetue.ShowDialog() == DialogResult.OK) { BgWait1.RunWorkerAsync("SearchData"); } } else { ClsMsg.ShowWarningMsg("选中要修改的设备信息"); } break; case "bbtnExit": this.Close(); break; default: break; } } } catch (Exception ex) { ClsMsg.ShowErrMsg(ex.ToString()); } }
private void BgWait1_DoWork(object sender, DoWorkEventArgs e) { BgWait1.ReportProgress(0); try { switch (e.Argument.ToString()) { case "SearchData": Tuple <StringBuilder, List <object> > dtFilter = Tuple.Create <StringBuilder, List <object> >(new StringBuilder(), new List <object>()); dtFilter.Item1.Append("1=1"); FilterProcess.MergeFilterCondition("ArrangedVouchCode", textEdit1.EditValue, ref dtFilter); FilterProcess.MergeFilterCondition("MaterialVouchCode", textEdit2.EditValue, ref dtFilter); FilterProcess.MergeFilterCondition("FormulaCode", textEdit3.EditValue, ref dtFilter); FilterProcess.MergeFilterCondition("FormulaName", textEdit4.EditValue, ref dtFilter); FilterProcess.MergeFilterCondition("UserStatus", Convert.ToInt32(UseStatusLookUpEdit.EditValue), ref dtFilter, dataType: FilterProcess.DataType.Int); FilterProcess.MergeFilterCondition("VouchDate", dStartDate.EditValue, ref dtFilter, objValues1: dEndDate.EditValue, dataType: FilterProcess.DataType.DateTime); //按日期区间查询 int iCurrPage = (int)page.CurrentPage; int iPageSize = (int)page.PageSize; //using (var client = new SRArrangedVouch.ArrangedVServiceClient()) //{ var ret = WCFHelper.InvokeService <SRArrangedVouch.IArrangedVServiceChannel, SRArrangedVouch.CommonResultOfArrayOfArrangedVouchdYMi5huk>(context, wcf => wcf.GetArrangedVouchList(context.SessionID, Tuple.Create <string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iPageSize, iCurrPage)); //var ret = client.GetArrangedVouchList(context.SessionID, Tuple.Create<string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iPageSize, iCurrPage); if (ret.IsSuccess) { page.CurrentPage = iCurrPage; page.RowCount = ret.TotalNum; e.Result = ret.Data; } else { BgWait1.ReportProgress(101, ret.Message); } // } break; default: break; } } catch (Exception ex) { BgWait1.ReportProgress(102, ex.Message); } BgWait1.ReportProgress(100); }
/// <summary> /// 线程控件响应事件,只需响应搜索事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BgWait1_DoWork(object sender, DoWorkEventArgs e) { BgWait1.ReportProgress(0); try { switch (e.Argument.ToString()) { case "SearchData": Tuple <StringBuilder, List <object> > dtFilter = Tuple.Create <StringBuilder, List <object> >(new StringBuilder(), new List <object>()); dtFilter.Item1.Append("1=1"); FilterProcess.MergeFilterCondition("DevCode", textEdit1.EditValue, ref dtFilter); FilterProcess.MergeFilterCondition("DevpCode", textEdit2.EditValue, ref dtFilter, strCompare: "like"); FilterProcess.MergeFilterCondition("DeviCode", textEdit3.EditValue, ref dtFilter); int iCurrPage = (int)page.CurrentPage; int iPageSize = (int)page.PageSize; using (var client = new SRExcute.DevExecuteServiceClient()) { var ret = client.GetDevExecutePagedList(context.SessionID, Tuple.Create <string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iPageSize, iCurrPage); if (ret.IsSuccess) { page.CurrentPage = iCurrPage; page.RowCount = ret.TotalNum; e.Result = ret.Data; } else { BgWait1.ReportProgress(101, ret.Message); } } break; default: break; } } catch (Exception ex) { BgWait1.ReportProgress(102, ex.Message); } BgWait1.ReportProgress(100); }
private void BgWait1_DoWork(object sender, DoWorkEventArgs e) { BgWait1.ReportProgress(0); try { switch (e.Argument.ToString()) { case "Refresh": // MessageBox.Show(MyAddress); // dataGridView1.DataSource = client.GetDevViewList("text"); // dataGridView1.Refresh(); // String str = this.dataGridView1.SelectedCells[0].Value.ToString(); // MessageBox.Show(str); break; case "bttniStartTask": if (ClsMsg.ShowQuestionMsg("启动任务?") == DialogResult.Yes) { workTask.StartTask(); } break; case "bttniEndTask": if (ClsMsg.ShowQuestionMsg("停止任务?") == DialogResult.Yes) { workTask.StopTask(); } break; default: break; } } catch (Exception ex) { BgWait1.ReportProgress(102, ex.Message); } BgWait1.ReportProgress(100); }
private void BgWait1_DoWork(object sender, DoWorkEventArgs e) { BgWait1.ReportProgress(PubConstant.WaitMessageStatus.START); try { switch (e.Argument.ToString()) { case "SearchData": Tuple <StringBuilder, List <object> > dtFilter = Tuple.Create <StringBuilder, List <object> >(new StringBuilder(), new List <object>()); dtFilter.Item1.Append("1=1"); FilterProcess.MergeFilterCondition("FLVCode", textEdit1.EditValue, ref dtFilter, strCompare: "like"); FilterProcess.MergeFilterCondition("CreateDate", dateEdit1.EditValue, ref dtFilter, dataType: FilterProcess.DataType.Date, strCompare: ">="); int iCurrPage = (int)page.CurrentPage; int iPageSize = (int)page.PageSize; using (var client = new SRFindLeak.QCDFindLeakServiceClient()) { var ret = client.GetQCDrumsFindLeakList(context.SessionID, Tuple.Create <string, object[]>(dtFilter.Item1.ToString(), dtFilter.Item2.ToArray()), iPageSize, iCurrPage); if (ret.IsSuccess) { page.CurrentPage = iCurrPage; page.RowCount = ret.TotalNum; e.Result = ret.Data; } else { BgWait1.ReportProgress(101, ret.Message); } } break; default: break; } } catch (Exception ex) { BgWait1.ReportProgress(PubConstant.WaitMessageStatus.ERROR, ex.Message); } BgWait1.ReportProgress(100); }
private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { try { if (BgWait1.IsBusy == false) { switch (e.ClickedItem.Name) { case "bttniStartTask": BgWait1.RunWorkerAsync("bttniStartTask"); break; case "bttniEndTask": BgWait1.RunWorkerAsync("bttniEndTask"); break; case "bbtniExit": this.Close(); break; default: break; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 搜索按钮响应时间 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { BgWait1.RunWorkerAsync("SearchData"); }