public DefaultLiveDataProviderFactory(IBusTrackerLocationService locationService) { _locationService = locationService; _locationService.AreaChanged += this.OnAreaChanged; _currentArea = _locationService.CurrentArea; }
public RouteStopsViewModel( ILiveDataProviderFactory providerFactory, IBusTrackerLocationService locationService) { _providerFactory = providerFactory; _locationService = locationService; this.Stops = new ReadOnlyObservableCollection <RouteStopsListItemViewModel>(_stops); this.RefreshCommand = new MvxCommand <bool>(this.Refresh, noCache => !this.IsBusy); this.ShowStopDetailsCommand = new MvxCommand <RouteStopsListItemViewModel>(this.ShowStopDetails, vm => !this.IsBusy); }
public MapViewModel( IBusTrackerLocationService locationService, ILiveDataProviderFactory providerFactory, IConfigManager configManager, IMvxMessenger messenger) { _providerFactory = providerFactory; _configManager = configManager; _messenger = messenger; _locationService = locationService; _locationService.AreaChanged += (s, a) => { this.DetectedArea = a.Detected; this.ChangeArea(a.Area, a.LastLocation); }; _config = _configManager.GetConfig(); this.MapRouteStopsViewModel = Mvx.IocConstruct <MapRouteStopsViewModel>(); this.MapRouteStopsViewModel.RouteStopSelected += (s, a) => this.CenterMap(a.RouteStop.Location.Position); this.MapVehiclesViewModel = Mvx.IocConstruct <MapVehiclesViewModel>(); this.SelectRouteStopCommand = new MvxCommand <string>(this.SelectRouteStop); this.SelectVehicleCommand = new MvxCommand <string>(this.SelectVehicle); this.ClearSelectionCommand = new MvxCommand(this.ClearSelection); this.UpdateMapCenterCommand = new MvxCommand <Tuple <GeoPoint, bool> >(tuple => { if (tuple.Item2) { this.MapCenter = tuple.Item1; } else { _mapCenter = tuple.Item1; } }); _routeStopInfoSubscriptionToken = _messenger.Subscribe <ShowRouteStopForecastOnMapMessage>( message => this.SelectRouteStopCommand.Execute(message.RouteStopId)); _vehicleInfoSubscriptionToken = _messenger.Subscribe <ShowVehicleForecastOnMapMessage>( message => this.SelectVehicleCommand.Execute(message.VehicleId)); }
public HomeViewModel( IMvxMessenger messenger, IBusTrackerLocationService busTrackerLocationService, IAreaPositioningService areaPositioningService, IConfigManager configManager) { this.MenuItems = new ReadOnlyObservableCollection <MenuViewModel>(this.CreateMenuViewModels()); this.SelectMenuItemCommand = new MvxCommand <MenuSection>(this.SelectMenuItem); _messenger = messenger; _configManager = configManager; _areaPositioningService = areaPositioningService; _locationService = busTrackerLocationService; _locationService.AreaChanged += (s, a) => this.UpdateSelectedArea(a.Area); _taskChangedMessagesSubscription = _messenger.Subscribe <BackgroundTaskStateChangedMessage>(this.OnBackgroundTaskStateChanged); Areas = new ReadOnlyCollection <AreaViewModel>(_areas); this.UpdateVehicleLocationsCommand = new MvxCommand(this.UpdateVehicleLocations); this.SelectAreaCommand = new MvxCommand <int>(this.SelectArea); }