private async Task LoadChapter()
 {
     if (SelectedChapter is null)
     {
         return;
     }
     try
     {
         var chapter = SelectedChapter;
         Chapters.First(ch => ch.Id == chapter.Id).ChapterRead = true;
         //await _historyService.MarkChapter(Work.WorkId, SelectedChapter.Id);
         await Navigator.NavigateToAsync("ChapterReading",
                                         new Dictionary <string, object> {
             { "chapter", chapter }, { "work", Work }
         });
     }
     catch (Exception ex)
     {
         await Alerts.CallAlertAsync(ex);
     }
     finally
     {
         SelectedChapter = null;
     }
 }
Beispiel #2
0
 public override async Task HandleNavigation(IReadOnlyDictionary <string, object> parameters = null)
 {
     try
     {
         LoadingHistories = HasHistories = true;
         await ManageFavorites();
         await ManageDiscover();
     }
     catch (Exception e)
     {
         await Alerts.CallAlertAsync(e);
     }
     finally
     {
         LoadingHistories = false;
         HasHistories     = DiscoverWorks.Any();
     }
 }
Beispiel #3
0
 private async Task ShowHistoryDetails()
 {
     if (SelectedHistory is null)
     {
         return;
     }
     try
     {
         var work = SelectedHistory as Work;
         SelectedHistory = null;
         await Navigator.NavigateToAsync("WorkDetails", new Dictionary <string, object> {
             { "work", work }
         });
     }
     catch (Exception ex)
     {
         await Alerts.CallAlertAsync(ex);
     }
 }
Beispiel #4
0
        private async Task SearchHistories(string search)
        {
            try
            {
                DiscoverWorks.Clear();
                var works = await Service.SearchWorks(search);

                works.ForEach(DiscoverWorks.Add);
            }
            catch (Exception ex)
            {
                await Alerts.CallAlertAsync(ex);
            }
            finally
            {
                HasHistories       = DiscoverWorks.Any();
                LoadingHistories   = false;
                DiscoverRefreshing = false;
            }
        }