Beispiel #1
0
        public TripLocationViewModel(
            ISchedulerProvider schedulerProvider,
            INavigationService navigationService,
            ISearchPlaceViewModelFactory searchPlaceViewModelFactory)
        {
            _pickupLocationEditorViewModel      = searchPlaceViewModelFactory.GetPickupLocationEditorViewModel();
            _destinationLocationEditorViewModel = searchPlaceViewModelFactory.GetDestinationLocationEditorViewModel(this);
            _navigationService = navigationService;

            _pickupLocationEditorViewModel.SelectedAddress
            .ObserveOn(schedulerProvider.SynchronizationContextScheduler)
            .Subscribe(address =>
            {
                PickupAddress.SetAddress(address);
                _pickupLocationChanged.OnNext(true);
                _navigationService.GoBack();
            });

            _destinationLocationEditorViewModel.SelectedAddress
            .ObserveOn(schedulerProvider.SynchronizationContextScheduler)
            .Subscribe(address =>
            {
                DestinationAddress.SetAddress(address);
                CanRequest = true;
                _navigationService.GoBack();
            });
        }
        public MainViewModel(
            ISchedulerProvider schedulerProvider,
            IGeocodingProvider geocodingProvider,
            ILocationManager locationManager,
            INavigationService navigationService,
            ISearchPlaceViewModelFactory searchPlaceViewModelFactory)
        {
            _schedulerProvider = schedulerProvider;
            _geocodingProvider = geocodingProvider;
            _locationManager   = locationManager;

            MyLocationChanged = locationManager.LocationChanged;


            PickupLocationEditorViewModel      = searchPlaceViewModelFactory.GetPickupLocationEditorViewModel();
            DestinationLocationEditorViewModel = searchPlaceViewModelFactory.GetDestinationLocationEditorViewModel();
            _navigationService = navigationService;
        }