private async void TV_Table_MouseDoubleClick(object sender, MouseEventArgs e) { MyPipeline myPipeline = new MyPipeline(); myPipeline.Conditions = new SearchCondition[] { }; myPipeline.SkipSize = int.Parse(tb_Skip.Text); myPipeline.LimitSize = int.Parse(tb_Limit.Text); await BeginAdvanceSearch(this.TV_Table.SelectedNode.Text, myPipeline); }
private async void btn_Next_Click(object sender, EventArgs e) { MyPipeline myPipeline = new MyPipeline(); myPipeline.Conditions = new SearchCondition[] { }; myPipeline.SkipSize = int.Parse(tb_Skip.Text) + int.Parse(tb_Limit.Text); myPipeline.LimitSize = int.Parse(tb_Limit.Text); await BeginAdvanceSearch(this.TV_Table.SelectedNode.Text, myPipeline); tb_Skip.Text = myPipeline.SkipSize.ToString(); }
private async Task BeginAdvanceSearch(string tableName, MyPipeline myPipeline) { //UI控制 this.TV_Table.Enabled = false; this.DG_DataResult.Enabled = false; this.tb_Skip.Enabled = false; this.tb_Limit.Enabled = false; this.btn_Previous.Enabled = false; this.btn_Next.Enabled = false; this.toolStripStatusLabel1.Text = "获取数据中......."; //开始秒表计时 Stopwatch timer = new Stopwatch(); timer.Start(); //数据清空 string[] ProjectFieldsNames = null; this.DG_DataResult.DataSource = null; var fieldsResult = await aliyunApi.GetData("/api/Table/" + tableName); var fieldsResultDyn = JsonConvert.DeserializeObject <dynamic>(fieldsResult); var SelectedTableFields = ((JArray)fieldsResultDyn).Where(p => !p["name"].ToString().Contains("Dic")).Select(x => x["key"].ToString()).ToArray(); if (!string.IsNullOrEmpty(myPipeline.Projects)) { ProjectFieldsNames = myPipeline.Projects.Split(','); } else { ProjectFieldsNames = SelectedTableFields; } AddDgRow(ProjectFieldsNames); var result = await aliyunApi.PostData("/api/Table/" + tableName, myPipeline); var PostResultData = BsonSerializer.Deserialize <dynamic>(result); this.DG_DataResult.DataSource = PostResultData; this.TV_Table.Enabled = true; this.DG_DataResult.Enabled = true; this.tb_Skip.Enabled = true; this.tb_Limit.Enabled = true; this.btn_Previous.Enabled = true; this.btn_Next.Enabled = true; timer.Stop(); this.toolStripStatusLabel1.Text = "共" + this.DG_DataResult.RowCount.ToString() + "行;" + "耗时:" + timer.ElapsedMilliseconds.ToString() + "毫秒"; }