public bool AddAyahBookmark(QuranAyah ayah) { try { using (var adapter = new BookmarksDatabaseHandler()) { if (ayah == null) { adapter.AddBookmarkIfNotExists(null, null, CurrentPageNumber); } else { adapter.AddBookmarkIfNotExists(ayah.Surah, ayah.Ayah, CurrentPageNumber); } } CurrentPageBookmarked = BookmarksDatabaseHandler.IsPageBookmarked(CurrentPageNumber); return(true); } catch (Exception e) { QuranApp.NativeProvider.Log("error creating bookmark"); telemetry.TrackException(e, new Dictionary <string, string> { { "Scenario", "AddBookmark" } }); return(false); } }
private async Task LoadCurrentPage() { await LoadPage(CurrentPage); if (CurrentPageIndex - 1 > 0) { LoadPage(Pages[CurrentPageIndex - 1]); } if (CurrentPageIndex + 1 < Pages.Count) { LoadPage(Pages[CurrentPageIndex + 1]); } var pageNumber = GetPageNumberFromIndex(CurrentPageIndex); CurrentSurahName = QuranUtils.GetSurahNameFromPage(pageNumber, false); CurrentSurahNumber = QuranUtils.GetSurahNumberFromPage(pageNumber); var rub = QuranUtils.GetRub3FromPage(pageNumber); CurrentJuzName = string.Format("{0} {1}{2} {3} {4}", QuranUtils.GetJuzTitle(), QuranUtils.GetJuzFromPage(pageNumber), getJuzPart(rub), Resources.quran_rub3, rub + 1); CurrentPageBookmarked = BookmarksDatabaseHandler.IsPageBookmarked(CurrentPageNumber); if (!IsLoading) { SettingsUtils.Set <int>(Constants.PREF_LAST_PAGE, pageNumber); } }
private async Task LoadCurrentPage() { var tempCurrentPageIndex = CurrentPageIndex; var _currentPage = GetPageFromIndex(tempCurrentPageIndex); if (_currentPage == null) { return; } await _currentPage.Load(this.TranslationFile, _bismillahTranslation); var pageNumber = GetPageNumberFromIndex(tempCurrentPageIndex); CurrentSurahName = QuranUtils.GetSurahNameFromPage(pageNumber, false); CurrentSurahNumber = QuranUtils.GetSurahNumberFromPage(pageNumber); var rub = QuranUtils.GetRub3FromPage(pageNumber); CurrentJuzName = string.Format("{0} {1}{2} {3} {4}", QuranUtils.GetJuzTitle(), QuranUtils.GetJuzFromPage(pageNumber), getJuzPart(rub), Resources.quran_rub3, rub + 1); CurrentPageBookmarked = BookmarksDatabaseHandler.IsPageBookmarked(pageNumber); // Load previous and next pages var _previousPage = GetPageFromIndex(tempCurrentPageIndex - 1); if (_previousPage != null) { await _previousPage.Load(this.TranslationFile, _bismillahTranslation); } var _nextPage = GetPageFromIndex(tempCurrentPageIndex + 1); if (_nextPage != null) { await _nextPage.Load(this.TranslationFile, _bismillahTranslation); } if (!IsLoading) { SettingsUtils.Set <int>(Constants.PREF_LAST_PAGE, pageNumber); } }
public bool TogglePageBookmark() { try { using (var adapter = new BookmarksDatabaseHandler()) { adapter.TogglePageBookmark(CurrentPageNumber); } CurrentPageBookmarked = BookmarksDatabaseHandler.IsPageBookmarked(CurrentPageNumber); return(true); } catch (Exception e) { QuranApp.NativeProvider.Log("error creating bookmark"); telemetry.TrackException(e, new Dictionary <string, string> { { "Scenario", "TogglePageBookmark" } }); return(false); } }