protected override void OnInitialize() { base.OnInitialize(); if (TransientStorage.Contains(CatalogBookItemKey)) { CatalogBookItemModel = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); } }
protected override void OnInitialize() { base.OnInitialize(); if (TransientStorage.Contains(CatalogBookItemKey)) { CatalogBookItemModel = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); } _book = _bookRepository.Get(BookId, false); DisplayName = string.Format(UIStrings.SearchInBookPage_Title, _book.Title).ToUpper(); }
protected override void OnInitialize() { base.OnInitialize(); if (TransientStorage.Contains(CatalogBookItemKey)) { CatalogBookItemModel = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); } _thisBookBookmarksViewModel.BookId = BookId; _thisBookBookmarksViewModel.CatalogId = CatalogId; _thisBookBookmarksViewModel.CatalogBookItemModel = CatalogBookItemModel; Items.Add(_thisBookBookmarksViewModel); Items.Add(_allBooksBookmarksViewModel); }
private async Task CheckForDownloadItem(string url) { var link = await GetDownloadLink(url); if (link != null) { if (!string.IsNullOrEmpty(CatalogBookItemKey) && TransientStorage.Contains(CatalogBookItemKey)) { var catalogBookItem = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); catalogBookItem.Links = new List <BookDownloadLinkModel> { link }; _navigationService .UriFor <BookInfoPageViewModel>() .WithParam(vm => vm.Title, catalogBookItem.Title.ToUpper()) .WithParam(vm => vm.Description, catalogBookItem.Description) .WithParam(vm => vm.ImageUrl, catalogBookItem.ImageUrl) .WithParam(vm => vm.CatalogId, CatalogId) .WithParam(vm => vm.StartDownload, true) .WithParam(vm => vm.CatalogBookItemKey, TransientStorage.Put(catalogBookItem)) .Navigate(); _navigated = true; } else { var catalogBookItemModel = new CatalogBookItemModel { Links = new List <BookDownloadLinkModel> { link }, Title = Title, Id = Guid.NewGuid().ToString() }; _downloadController.DownloadBook(catalogBookItemModel, CatalogId); _catalogItemId = catalogBookItemModel.Id; } } }
protected override void OnInitialize() { base.OnInitialize(); if (TransientStorage.Contains(CatalogBookItemKey)) { CatalogBookItemModel = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); } if (!string.IsNullOrEmpty(BookId)) { InitializeBook(); } else { if (CatalogBookItemModel != null) { if (CheckIsDownloaded()) { return; } if (CheckForExistingTrial()) { InitializeBook(); } else { Title = !string.IsNullOrEmpty(CatalogBookItemModel.Title) ? CatalogBookItemModel.Title : null; Author = CatalogBookItemModel.Author; Description = CatalogBookItemModel.Description; IsBookFree = CatalogBookItemModel.AcquisitionLink == null; ApplicationBarIndex = 1; } } ShowOverlayIfBookDownloading(); } }
protected override void OnInitialize() { base.OnInitialize(); Book = _bookRepository.Get(BookId); if (Book == null) { _navigationService.GoBack(); return; } if (ToLastReadPage) { TokenOffset = Book.CurrentTokenID; } if (TransientStorage.Contains(CatalogBookItemKey)) { CatalogBookItemModel = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); } UpdateIsFavouriteBook(); }
public async void Login() { try { if (string.IsNullOrEmpty(_userName) || string.IsNullOrEmpty(_password)) { _notificationsService.ShowAlert(UINotifications.General_AttentionCaption, UINotifications.AuthorizationPage_WrongPasswordOrUserName); return; } StartBusiness(); var authorizationService = _authorizationFactory.GetAuthorizationService(new CatalogModel { Id = CatalogId, Type = CatalogType }); var authorizationString = await authorizationService.Authorize(_userName, _password, Path); if (!string.IsNullOrEmpty(authorizationString)) { var catalog = _catalogRepository.Get(CatalogId); catalog.AuthorizationString = EncryptService.Encrypt(authorizationString); _catalogRepository.Save(catalog); if (!string.IsNullOrEmpty(CatalogBookItemKey)) { var catalogBookItemModel = TransientStorage.Get <CatalogBookItemModel>(CatalogBookItemKey); _navigationService .UriFor <BookInfoPageViewModel>() .WithParam(vm => vm.Title, catalogBookItemModel.Title.ToUpper()) .WithParam(vm => vm.Description, catalogBookItemModel.Description) .WithParam(vm => vm.ImageUrl, catalogBookItemModel.ImageUrl) .WithParam(vm => vm.CatalogId, CatalogId) .WithParam(vm => vm.CatalogBookItemKey, TransientStorage.Put(catalogBookItemModel)) .Navigate(); } else { _navigationService.UriFor <CatalogPageViewModel>() .WithParam(vm => vm.CatalogId, catalog.Id) .WithParam(vm => vm.DisplayName, _catalogController.GetCatalogTitle(catalog).ToUpper()) .WithParam(vm => vm.IsSearchEnabled, !string.IsNullOrEmpty(catalog.SearchUrl) || catalog.Type == CatalogType.SDCard || catalog.Type == CatalogType.SkyDrive) .WithParam(vm => vm.CanRefresh, catalog.Type != CatalogType.SDCard) .Navigate(); } } else { StopBusiness(); _notificationsService.ShowAlert(UINotifications.General_AttentionCaption, UINotifications.AuthorizationPage_WrongPasswordOrUserName); } } catch (Exception exception) { _errorHandler.Handle(exception); } finally { StopBusiness(); } }