public StationMapViewModel(IEventAggregator events, SystemConfig config, CityContextViewModel cityContext)
     : base(events, config, cityContext)
 {
     #if DEBUG
     IsARVisible = true;
     #endif
 }
 protected override void OnInitialize()
 {
     base.OnInitialize();
     config = IoC.Get<SystemConfig>();
     VersionHistory = App.CurrentApp.VersionHistory;
     // flatten the list by creating a new array for VH and appending its Changes, then flatten with SelectMany
     FlatVersionHistory = VersionHistory
         .Select(vh => new object[] { vh }.Concat(vh.Changes))
         .SelectMany(o => o)
         .Select(v => new VersionItemViewModel(v)).ToList();
     NotifyOfPropertyChange(() => FlatVersionHistory);
 }
 public CityContextViewModel(IEventAggregator events, SystemConfig config)
 {
     this.events = events;
     this.config = config;
     subCity = new Subject<City>();
     obsCity = subCity
         .Publish(city)
         .RefCount()
         .SubscribeOn(ThreadPoolScheduler.Instance)
         .ObserveOn(ThreadPoolScheduler.Instance);
     ObserveCurrentCity(true);
 }
 public SystemConfigViewModel(IEventAggregator events, SystemConfig config, CityContextViewModel cityContext)
 {
     this.events = events;
     this.config = config;
     this.cityContext = cityContext;
     this.Cities = new List<City>();
     Cities.Add(new City() { CityName = " - automatic - " });
     Cities.AddRange(BikeServiceProvider.GetAllCities().OrderBy(c => c.Country + c.CityName));
     if (string.IsNullOrEmpty(config.City))
         selectedCity = Cities[0];
     else
         selectedCity = Cities.Where(c => config.City.Equals(c.UrlCityName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
 }
 public NavigationViewModel(IEventAggregator events, SystemConfig config, CityContextViewModel cityContext)
     : base(events, config, cityContext)
 {
     this.DestinationLocation = new LocationViewModel();
     this.RouteLegs = new ObservableCollection<NavigationRouteLegViewModel>();
 }
 public static double GetTravelDuration(NavigationResponse routeResponse, SystemConfig config, out double travelDistance)
 {
     travelDistance = 1000 * routeResponse.Route.TravelDistance;
     var travelDuration = routeResponse.Route.TravelDuration;
     if (routeResponse.Route.RouteLegs != null)
     {
         var routeLegs = routeResponse.Route.RouteLegs;
         if (routeLegs.Count == 1 || routeLegs.Count == 3)
         {
             var walkingDistance = routeLegs[0].TravelDistance;
             if (routeLegs.Count == 3)
                 walkingDistance += routeLegs[2].TravelDistance;
             var walkingSpeed = LocationHelper.GetTravelSpeed(TravelType.Walking, config.WalkingSpeed, false);
             travelDuration = 3600 * walkingDistance / walkingSpeed;
             if (routeLegs.Count == 3)
             {
                 var cyclingDistance = routeLegs[1].TravelDistance;
                 var cyclingSpeed = LocationHelper.GetTravelSpeed(TravelType.Cycling, config.CyclingSpeed, false);
                 travelDuration += 3600 * cyclingDistance / cyclingSpeed;
             }
             travelDuration = (int)travelDuration;
         }
     }
     return travelDuration;
 }
 public static double GetTravelDuration(NavigationResponse routeResponse, SystemConfig config)
 {
     double travelDist;
     return GetTravelDuration(routeResponse, config, out travelDist);
 }
 private void LoadDatabase()
 {
     config = IoC.Get<SystemConfig>();
     if (config != null && config.LocationEnabled.HasValue)
         return;
     // CM handles this so it's always instantiated (as a singleton)
     if (config == null)
     {
         config = new SystemConfig();
         container.Instance(config);
     }
 }
 public AboutViewModel(SystemConfig config)
 {
     this.config = config;
 }