public InitViewModel( IAreaPositioningService areaPositioningService, IUserInteraction userInteraction) { _userInteraction = userInteraction; _areaPositioningService = areaPositioningService; _areaPositioningService.AreaLocated += this.OnAreaLocated; _areaPositioningService.AreaLocatingFailed += this.OnAreaLocatingFailed; this.SelectManuallyCommand = new MvxCommand(this.SelectManually); this.DetectLocationCommand = new MvxCommand(this.DetectLocation); }
public BusTrackerLocationService(ILocationService locationService, IAreaPositioningService areaPositioningService) { _locationService = locationService; _areaPositioningService = areaPositioningService; _areaPositioningService.AreaLocated += (s, a) => this.RaiseAreaChangedEvent( this.CurrentArea, this.DetectedArea, this.DetectedArea ? _locationService.GetLastLocation() : new GeoPoint( this.CurrentArea.Latitude, this.CurrentArea.Longitude)); }
public SetAreaViewModel(IConfigManager configManager, IAreaPositioningService locationService) { _locationService = locationService; var areaVMs = configManager.GetConfig() .Areas .Select(a => new AreaViewModel(a, this[string.Format(AppConsts.AreaLocalizedNameStringKeyFormat, a.Id)])) .ToList(); this.Areas = new ObservableCollection <AreaViewModel>(areaVMs); this.SelectAreaCommand = new MvxCommand <int>(this.SelectAreaManually); this.CancelCommand = new MvxCommand(this.Cancel); }
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); }