示例#1
0
        private async Task Refresh()
        {
            await SynchronizeWithServer();

            var localBooks = _database.SelectTable <ClientBookDto>();

            mAdapter.Clear();
            mAdapter.AddBooks(localBooks);
        }
示例#2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            UserDialogs.Init(this);

            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_booklist);

            _context = await this.CreateContextAsync();

            _adapter = new LibraryAdapter(this);

            var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView_bookList);

            recyclerView.SetAdapter(_adapter);
            _adapter.RecyclerView = recyclerView;

            recyclerView.SetLayoutManager(new LinearLayoutManager(this));

            var bookList = await _context.Books.AsNoTracking().ToListAsync();

            _adapter.AddBooks(bookList);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButton_addBook);

            fab.Click += FabOnClick;
        }