public void LoadUserControl(KillDrugEditView view) { ViewSelf = view; ViewSelf.cbKillCull.ItemsSource = iKillCullService.GetPagerKillCull(string.Empty, 1, 100); ViewSelf.cbKillCull.SelectedValuePath = "KillCullID"; ViewSelf.cbKillCull.DisplayMemberPath = "KillCullID"; //ICompanyService iCompanyService = new CompanyService(); //var landBases = iCompanyService.GetCompanyById(); //view.lbLand.ItemsSource = landBases; //view.lbLand.SelectedValuePath = "LandID"; //view.lbLand.DisplayMemberPath = "LandName"; //if(Mode == EditMode.CREATE) //{ // NotifyOfPropertyChange(() => Model); //} }
private void LoadData(string key, int pageIndex = 1, int pageSize = 10) { pbLoading.Visibility = Visibility.Visible; Task.Factory.StartNew(() => { var list = iKillCullService.GetPagerKillCull(key, pageIndex, pageSize); var total = iKillCullService.GetKillCullCount(key); var pageCount = total / pageSize == 0 ? 1 : (total / pageSize) + (total % pageSize == 0 ? 0 : 1); ModelCollection = new BindableCollection <KillCullModel>(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; })); }); }