protected override void OnAppearing() { base.OnAppearing(); var vm = new BooksPageViewModel(); vm.Initialize(); BindingContext = vm; }
public BooksPage() { var bookStore = new BookStoreService(); var pageService = new PageService(); ViewModel = new BooksPageViewModel(bookStore, pageService); InitializeComponent(); ViewModel.LoadBooksCommand.Execute(null); }
private async Task <BooksPageViewModel> GetBooksPage(int page) { IQueryable <Book> source = _db.Books.Where(b => b.Quantity > 0); int count = await source.CountAsync(); int totalPages = (int)Math.Ceiling(count / (double)_pageSize); if (page < 1) { page = 1; } else if (page > totalPages) { page = totalPages; } var books = await source.Skip((page - 1) *_pageSize).Take(_pageSize).ToListAsync(); BooksPageViewModel pageViewModel = new BooksPageViewModel(page, _pageSize, totalPages, books); return(pageViewModel); }
public BooksPage() { InitializeComponent(); DataContext = new BooksPageViewModel(); }
public BooksPage(string genrePath) { InitializeComponent(); vm = new BooksPageViewModel(genrePath); BindingContext = vm; }
public BooksPage() { InitializeComponent(); vm = new BooksPageViewModel(); BindingContext = vm; }