public GroupViewModel(AccountItemDataLodingHandler loadingDataHandler) { this.GroupItems = new ObservableCollection<GroupByCreateTimeAccountItemViewModel>(); this.viewModeInfo = new ViewModeConfig(); this.isDataLoaded = false; this.viewModeInfo.PropertyChanged += new PropertyChangedEventHandler(this.ViewModeInfo_PropertyChanged); this.LoadingDataHandler = loadingDataHandler; }
void MainPivotTitle_SelectionChanged(object sender, SelectionChangedEventArgs e) { int selectedIndex = this.MainPivotTitle.SelectedIndex; GroupViewModel expensesViewModel = ViewModelLocator.ExpensesViewModel; switch (selectedIndex) { case 0: expensesViewModel = ViewModelLocator.ExpensesViewModel; this.vmc = ViewModelLocator.ExpensesViewModel.ViewModeInfo; // this.openCategoryPageMenuButton.Text = LocalizedStrings.GetCombinedText(this.ExpensesPivot.Header.ToString(), this.currentDialogItemTypeTitle, false); break; } if (!expensesViewModel.IsDataLoaded) { new System.Threading.Thread(delegate(object o) { (o as GroupViewModel).Load(); }).Start(expensesViewModel); } }
public System.Collections.Generic.IEnumerable<AccountItem> LoadingAllItem(ViewModeConfig viewModeConfig, ItemType itemType) { if (viewModeConfig.CustomizedSearchingIndex != -1) { System.DateTime startDate = viewModeConfig.SearchingCondition.StartDate.Value.Date; System.DateTime endDate = viewModeConfig.SearchingCondition.EndDate.Value.Date; return (from accountItem in this.AccountBookDataContext.AccountItems where ((accountItem.CreateTime.Date > startDate) && (accountItem.CreateTime.Date <= endDate)) && (((int)accountItem.Type) == ((int)itemType)) orderby accountItem.CreateTime descending select accountItem); } return (from accountItem in this.AccountBookDataContext.AccountItems where ((accountItem.CreateTime.Year == viewModeConfig.Year) && (accountItem.CreateTime.Month == viewModeConfig.Month)) && (((int)accountItem.Type) == ((int)itemType)) orderby accountItem.CreateTime descending select accountItem); }