Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 public NavigationViewModel(IEventAggregator events, SystemConfig config, CityContextViewModel cityContext)
     : base(events, config, cityContext)
 {
     this.DestinationLocation = new LocationViewModel();
     this.RouteLegs = new ObservableCollection<NavigationRouteLegViewModel>();
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 public static double GetTravelDuration(NavigationResponse routeResponse, SystemConfig config)
 {
     double travelDist;
     return GetTravelDuration(routeResponse, config, out travelDist);
 }
Ejemplo n.º 8
0
 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);
     }
 }
Ejemplo n.º 9
0
 public AboutViewModel(SystemConfig config)
 {
     this.config = config;
 }