private void SetInfoList(RequestInfoListModel requestInfoListModel) { loding.Visibility = Visibility.Visible; Task.Run(() => { ResultJson <ResponseInfoListModel> resultJson = InfoListService.getQuery(requestInfoListModel); if (resultJson.code == "20000") { List <InfoListModel> newList = ToDataGrid(resultJson.data.addIndex(resultJson.data.data) ?? new List <InfoListModel>()); this.Dispatcher.Invoke(() => { pageControl.DataTote = resultJson.data.total; dataGrid.ItemsSource = newList; loding.Visibility = Visibility.Hidden; }); } else { this.Dispatcher.Invoke(() => { MessageTips(resultJson.message); dataGrid.ItemsSource = ToDataGrid(new List <InfoListModel>()); loding.Visibility = Visibility.Hidden; }); } }); }
/// <summary> /// 回传专用 /// </summary> private void BackList() { Task.Run(() => { try { List <InfoListModel> allList = new List <InfoListModel>(); RequestInfoListModel requestInfoListModel = new RequestInfoListModel() { pageNo = 1, pageSize = 1 }; ResultJson <ResponseInfoListModel> resultJson = InfoListService.getQuery(requestInfoListModel); if (resultJson.code == "20000") { int times = resultJson.data.total / 1000 + 1; requestInfoListModel.pageSize = 1000; for (int i = 1; i <= times; i++) { requestInfoListModel.pageNo = i; resultJson = InfoListService.getQuery(requestInfoListModel); List <InfoListModel> newList = ToBack(resultJson.data.data ?? new List <InfoListModel>()); allList.AddRange(newList); } allList.Reverse(); SettingJsonConfig.saveData(allList); this.Dispatcher.Invoke(() => { ShowOK("数据回传完成"); }); return; } else { this.Dispatcher.Invoke(() => { ShowOK("数据回传失败,请稍后重试"); }); return; } } catch (Exception ex) { this.Dispatcher.Invoke(() => { ShowOK(ex.Message); }); return; } }); }