private void ItemClick(string param) { int index = int.Parse(param); if (Position == 1) { int book = outerViewModel.Book; int chapter = index; int[] items = BibleDataAccess.Instance().GetIndexCount(book, chapter); // 0 chapter count // 1 paragraph count outerViewModel.SearchPages[Position + 1].Items.Clear(); outerViewModel.SearchPages[Position + 1].Items = null; outerViewModel.SearchPages[Position + 1].Items = outerViewModel.GetGridItem(items[1]); outerViewModel.Chapter = chapter; outerViewModel.Position = Position + 1; } else if (Position == 2) { int book = outerViewModel.Book; int chapter = outerViewModel.Chapter; BibleDataAccess dataAccess = BibleDataAccess.Instance(); Console.WriteLine(book + " / " + chapter + " ** "); Console.WriteLine(GC.GetGeneration(outerViewModel.outerViewModel.Bible) + " <=== generation bible"); outerViewModel.outerViewModel.Bible.Clear(); outerViewModel.outerViewModel.Bible = null; outerViewModel.outerViewModel.Bible = new ObservableCollection <Bible>(dataAccess.SearchBibile(book, chapter)); //outerViewModel.outerViewModel.BiblePageOpen = !outerViewModel.outerViewModel.BiblePageOpen; outerViewModel.outerViewModel.SearchPageOpen = !outerViewModel.outerViewModel.SearchPageOpen; outerViewModel.Position = 0; outerViewModel.outerViewModel.ScrollPosition = index - 1; } // GC.Collect(); }
private void OnItemSelected(Object sender, SelectedItemChangedEventArgs e) { SearchViewModel vm = Parent.BindingContext as SearchViewModel; int[] index = BibleDataAccess.Instance().GetIndexCount(e.SelectedItemIndex + 1); ObservableCollection <SearchResult> items = new ObservableCollection <SearchResult>(); for (int i = 0; i < index.Length; i++) { vm.SearchPages[i + 1].Items.Clear(); vm.SearchPages[i + 1].Items = null; vm.SearchPages[i + 1].Items = vm.GetGridItem(index[i]); } vm.Book = e.SelectedItemIndex + 1; vm.Position = vm.Position + 1; }