private async void ButtonGetMonkeys_Clicked(object sender, EventArgs e) { Busy(); await vm.GetMonkeys(); Ready(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { activity.toolbar.Title = "Monkey Finder"; View view = inflater.Inflate(Resource.Layout.fragment_monkeys, container, false); var recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView); var refreshButton = view.FindViewById <Button>(Resource.Id.button_refresh); //add click handler refreshButton.Click += async(sender, args) => { refreshButton.Enabled = false; await viewModel.GetMonkeys(); refreshButton.Enabled = true; }; var adapter = new MonkeyAdapter(viewModel, activity); recyclerView.SetAdapter(adapter); var layoutManager = new LinearLayoutManager(Context); recyclerView.SetLayoutManager(layoutManager); return(view); }