public void LoadUserControl(PlansFertEditView view) { var landBlocks = iPlansBatchService.GetPagerPlansBatch(string.Empty, 1, 10); view.lbLand.ItemsSource = landBlocks; view.lbLand.SelectedValuePath = "BatchID"; view.lbLand.DisplayMemberPath = "BatchNO"; //ISeedBaseService iISeedBaseService = new SeedBaseService(); //var seeds = iISeedBaseService.GetPagerSeedBase(string.Empty, 1, 10); //view.lbSeed.SelectedValuePath = "SeedID"; //view.lbSeed.DisplayMemberPath = "SeedName"; //view.lbSeed.ItemsSource = seeds; }
private void LoadData(string key, int pageIndex = 1, int pageSize = 10) { pbLoading.Visibility = Visibility.Visible; Task.Factory.StartNew(() => { var list = iPlansBatchService.GetPagerPlansBatch(key, pageIndex, pageSize); var total = iPlansBatchService.GetPlansBatchCount(key); var pageCount = total / pageSize == 0 ? 1 : (total / pageSize) + (total % pageSize == 0 ? 0 : 1); ModelCollection = new BindableCollection <PlansBatchModel>(list); PagerModel = new PagerModel { TotalCount = total, PageCount = pageCount, DetailMsg = string.Format("[共{0}页/共{1}条]", pageCount, total) }; }).ContinueWith((task) => { System.Windows.Application.Current.Dispatcher.Invoke(new System.Action(() => { pbLoading.Visibility = Visibility.Collapsed; })); }); }