public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_past_trips, null); viewModel = new PastTripsViewModel(); recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView); refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); refresher.Refresh += (sender, e) => viewModel.LoadPastTripsCommand.Execute(null); adapter = new TripAdapter(Activity, viewModel); adapter.ItemClick += OnItemClick; adapter.ItemLongClick += OnItemLongClick; layoutManager = new LinearLayoutManager(Activity) { Orientation = LinearLayoutManager.Vertical }; recyclerView.SetLayoutManager(layoutManager); recyclerView.SetAdapter(adapter); recyclerView.ClearOnScrollListeners(); recyclerView.AddOnScrollListener(new TripsOnScrollListenerListener(viewModel, layoutManager)); return(view); }
public TripAdapter(Android.App.Activity activity, PastTripsViewModel viewModel) { this.activity = activity; this.viewModel = viewModel; this.viewModel.Trips.CollectionChanged += (sender, e) => { this.activity.RunOnUiThread(NotifyDataSetChanged); }; }
public override async void ViewDidLoad() { base.ViewDidLoad(); ViewModel = new PastTripsViewModel(); await ViewModel.ExecuteLoadPastTripsCommandAsync(); TableView.ReloadData(); TableView.TableFooterView = new UIView(new CGRect(0, 0, 0, 0)); RefreshControl.AddTarget(this, new Selector("RefreshSource"), UIControlEvent.ValueChanged); NSNotificationCenter.DefaultCenter.AddObserver(new NSString("RefreshPastTripsTable"), HandleReloadTableNotification); }
public TripsOnScrollListenerListener(PastTripsViewModel viewModel, LinearLayoutManager layoutManager) { this.layoutManager = layoutManager; this.viewModel = viewModel; }
public PastTripsMenuView() { InitializeComponent(); ViewModel = new PastTripsViewModel(); }
public PastTripsOverviewPage() { this.InitializeComponent(); PastTripVM = new PastTripsViewModel(); this.DataContext = PastTripVM; }