public RideEdit1ViewModel(INavigation mainNavigation, RideItemModelFull editableModel) { editRouteCommand = new Command(async i => { editableModel.rideDate = new DateTime( editableModel.rideDate.Year, editableModel.rideDate.Month, editableModel.rideDate.Day, editableModel.rideTime.Hours, editableModel.rideTime.Minutes, editableModel.rideTime.Seconds); editableModel.rideEdit2ViewModel = new RideEdit2ViewModel(mainNavigation, editableModel); var edit2 = new RideEdit2Page(); edit2.BindingContext = editableModel.rideEdit2ViewModel; await mainNavigation?.PushAsync(edit2); }); }
public RideListViewModel(Page mainNavigation) { rideList = new ObservableCollection <RideItemModel>(); init(); itemSelectedCommand = new Command <RideItemModel>(item => { //Manual downcast var model = new RideItemModelFull { rideName = item.rideName, rideDate = item.rideDate }; model.mapViewModel = new MapViewModel(mainNavigation.Navigation, model); var mapPage = new MapPage(); mapPage.BindingContext = model; mainNavigation.Navigation.PushAsync(mapPage); }); }
public MapViewModel(INavigation mainNavigation, RideItemModelFull model) { this.model = model; init(); editCommand = new Command(async o => { var editableItem = new RideItemModelFull { rideName = model.rideName, rideDescription = model.rideDescription, rideDate = model.rideDate, rideTime = model.rideDate.TimeOfDay, rideStartLocation = model.rideStartLocation, rideEndLocation = model.rideEndLocation }; editableItem.rideEdit1ViewModel = new RideEdit1ViewModel(mainNavigation, editableItem); var edit1 = new RideEdit1Page(); edit1.BindingContext = editableItem; await mainNavigation?.PushAsync(edit1); }); }
public RideEdit2ViewModel(INavigation navigation, RideItemModelFull editableModel) { pins = new ObservableCollection <UserPinModel>(); routes = new ObservableCollection <Polyline>(); saveCommand = new Command(async o => { System.Diagnostics.Debug.WriteLine("Saved!"); }); onAppearingCommand = new Command(() => { scheduleAutoCompletion(); isOnScreen = true; }); onDisappearingCommand = new Command(() => { isOnScreen = false; }); searchSuggestionSelectedCommand = new Command <Prediction>(async p => { isListViewVisible = false; allowedToShowAutoCompletion = false; searchText = p.description; allowedToShowAutoCompletion = true; await setLocationByPlaceID(p.place_id); }); addStartCommand = new Command(() => { addPin(MarkerType.Start); }); addLegCommand = new Command(() => { addPin(MarkerType.Leg); }); addStopoverCommand = new Command(() => { addPin(MarkerType.StopOver); }); addEndCommand = new Command(() => { addPin(MarkerType.End); }); }