protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            model     = new AuthorDataStore();
            viewModel = new ItemsViewModel <Author>(model);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

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

            recyclerView.HasFixedSize       = true;
            recyclerView.SetAdapter(adapter = new ItemsAdapter(this, viewModel));

            addBtn = FindViewById <FloatingActionButton>(Resource.Id.fab);
        }
        async Task ExecuteLoadAuthorsCommand()
        {
            IsBusy = true;

            try
            {
                Author.Clear();
                var _authors = await AuthorDataStore.GetItemsAsync(true);

                foreach (var _author in _authors)
                {
                    Author.Add(_author);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #3
0
 public void BeforeEachTest()
 {
     db = new AuthorDataStore(options);
 }