public async override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); ViewModel = new LogTimeEntriesViewModel (); await ViewModel.Init (); hasMoreBinding = this.SetBinding ( ()=> ViewModel.HasMore) .WhenSourceChanges (ShowEmptyState); collectionBinding = this.SetBinding ( ()=> ViewModel.CollectionView) .WhenSourceChanges (() => { logAdapter = new LogTimeEntriesAdapter (recyclerView, ViewModel.CollectionView); recyclerView.SetAdapter (logAdapter); }); fabBinding = this.SetBinding ( () => ViewModel.IsTimeEntryRunning, () => StartStopBtn.ButtonAction) .ConvertSourceToTarget (isRunning => isRunning ? FABButtonState.Stop : FABButtonState.Start); StartStopBtn.Click += StartStopClick; }
public async override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); viewModel = new LogTimeEntriesViewModel (); await viewModel.Init (); binding = Binding.Create (() => HasMore == viewModel.CollectionView.HasMore && ItemCount == viewModel.ItemCount && CollectionView == viewModel.CollectionView && IsRunning == viewModel.IsTimeEntryRunning); startStopBtn.Click += async (sender, e) => await viewModel.StartStopTimeEntry (); }