예제 #1
0
 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;
     }
 }
예제 #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();
     }
 }
예제 #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);
     }
 }
예제 #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;
            }
        }