Exemple #1
0
        private async void LoadBooks()
        {
            var books = await _booksService.GetBooksAsync();

            _books.Clear();
            foreach (var book in books)
            {
                _books.Add(book);
            }
            SelectedBook = Books.FirstOrDefault();
            _booksLoaded = true;
            AddBookCommand.RaiseCanExecuteChanged();
        }
Exemple #2
0
        private async void LoadBooks()
        {
            try
            {
                var books = await _booksService.GetBooksAsync();

                _books.Clear();
                foreach (var book in books)
                {
                    _books.Add(book);
                }
                SelectedBook = Books.FirstOrDefault();
                _booksLoaded = true;
                AddBookCommand.RaiseCanExecuteChanged();
            }
            catch (Exception ex)
            {
                // handling - write to log, inform user
            }
        }