private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SubmitDataProgress.IsActive = true;
            if (IsNewCard)
            {
                await WordCardsApiRequest.AddWordCard(VM);

                Frame.Navigate(typeof(WordCardItems), await WordBooksApiRequest.GetWordBook(VM.BookId));
            }
            else
            {
                await WordCardsApiRequest.UpdateWordCard(VM.Id, VM);

                Frame.Navigate(typeof(WordBookItems));
            }
            SubmitDataProgress.IsActive = false;
        }
Exemplo n.º 2
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     LoadingProgress.IsIndeterminate = true;
     LoadingProgress.ShowPaused      = false;
     LoadingProgress.ShowError       = false;
     foreach (var item in
              (await WordCardsApiRequest.GetWordCardsList())
              .Where(m => m.BookId ==
                     (e.Parameter as WordBook).Id))
     {
         WordCards.Add(item);
     }
     Header.Text = (e.Parameter as WordBook).Title;
     BookId      = (e.Parameter as WordBook).Id;
     LoadingProgress.ShowPaused = true;
     LoadingProgress.Visibility = Visibility.Collapsed;
 }
Exemplo n.º 3
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     LoadingProgress.IsIndeterminate = true;
     LoadingProgress.ShowPaused      = false;
     LoadingProgress.ShowError       = false;
     foreach (var item in await WordBooksApiRequest.GetWordBooksList())
     {
         IEnumerable <WordCard> cards =
             (await WordCardsApiRequest.GetWordCardsList()).Where(m => m.BookId == item.Id);
         Books.Add(new WordBookItemsViewModel
         {
             Book         = item,
             WordsNumber  = cards.Count(),
             LearnedWords = cards.Where(m => m.Score == 100).Count()
         });
     }
     LoadingProgress.ShowPaused = true;
     LoadingProgress.Visibility = Visibility.Collapsed;
 }
Exemplo n.º 4
0
 private async void ScoreUp()
 {
     VM.CurrentWord.Score += ScoreValue;
     await WordCardsApiRequest.UpdateWordCard(VM.CurrentWord.Id, VM.CurrentWord);
 }