Пример #1
0
        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();
        }
Пример #2
0
        public SearchViewModel(BibleViewModel vm)
        {
            outerViewModel     = vm;
            dataAccess         = BibleDataAccess.Instance();
            SearchPages        = new ObservableCollection <SearchModel>();
            PageChangedCommand = new Command <int>(PageChanged);

            BookMark bookMark = dataAccess.GetBookMark();

            Book    = bookMark.book;
            Chapter = bookMark.chapter;
            int[] indexInfo = dataAccess.GetIndexCount(bookMark.book, bookMark.chapter);


            for (int i = 0; i < 3; i++)
            {
                SearchModel model = new SearchModel(this);
                if (i >= 1)
                {
                    model.Items    = GetGridItem(indexInfo[i - 1]);
                    model.Position = i;
                }
                else
                {
                    model.Items    = dataAccess.GetBibleNames();
                    model.Position = i;
                }
                SearchPages.Add(model);
            }
        }
Пример #3
0
        private void LanguageChangeCommand(object param)
        {
            IsChecked = !IsChecked;
            BibleViewModel parentVM = (BibleViewModel)param;

            parentVM.Bible.Clear();
            parentVM.dataAccess.TOP_CASE = LanguageHelper.GetTopVersion(Settings.Languages.Split(','));
            parentVM.Bible = new ObservableCollection <Bible>(BibleDataAccess.Instance().GetBible(BibleDataAccess.Mode.Init));
        }
        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;
        }
Пример #5
0
        public BibleViewModel(TabbedPageViewModel rootViewModel)
        {
            MasterViewModel = rootViewModel;

            dataAccess          = BibleDataAccess.Instance();
            dataAccess.TOP_CASE = LanguageHelper.GetTopVersion(Settings.Languages.Split(','));

            bible        = new ObservableCollection <Bible>(dataAccess.GetBible(BibleDataAccess.Mode.Init));
            dashedBibles = new List <Bible>();

            colors = dataAccess.GetColors();
            searchPageViewModel = new SearchViewModel(this);

            for (int i = 0; i < languageName.Length; i++)
            {
                Language languase = new Language()
                {
                    Kind      = languageName[i],
                    IsChecked = Settings.Languages.Contains(languageName[i])
                };
                languages.Add(languase);
            }

            NavigationBarCommand    = new Command <string>(NavigationBarChanged);
            BibleSettingMenuCommand = new Command <string>(BibleSettingAction);
            OptionMenuCommand       = new Command <string>(OptionMenuAction);

            if (Settings.LightMode)
            {
                CellTextColor                       = "#000000";
                CellBackgroundColor                 = "#ffffff";
                searchPageViewModel.TextColor       = "#000000";
                searchPageViewModel.BackgroundColor = "#ffffff";
            }
            else
            {
                CellTextColor                       = "#ffffff";
                CellBackgroundColor                 = "#343434";
                searchPageViewModel.TextColor       = "#fffffff";
                searchPageViewModel.BackgroundColor = "#343434";
            }
        }