public static void Main(string[] args) { var options = new Options(); var parser = new CommandLine.Parser(); if (parser.ParseArguments(args, options)) { var configManager = new CliConfigManager(); Config = configManager.GetConfig(); var configEntry = Config.Areas.FirstOrDefault(x => x.Id.Equals(options.ServiceEndpoint)); if (configEntry == null) { Console.WriteLine("Invalid endpoint!"); return; } var service = new Bus13RouteDataService(configEntry.Endpoint, configEntry.Id); if (options.List) { ListVehicles(service); } if (options.Trace) { if (string.IsNullOrEmpty(options.VehicleId)) { Console.WriteLine("Vehicle id must be supplied!"); return; } if (!string.IsNullOrEmpty(options.OutputDir) && !Directory.Exists(options.OutputDir)) { Console.WriteLine("Directory {0} doesn't exist!", options.OutputDir); return; } IVehicleTraceOutputWriter outputWriter = null; if (string.IsNullOrEmpty(options.OutputType) || string.Equals("kml", options.OutputType, StringComparison.InvariantCultureIgnoreCase)) { outputWriter = new KmlOutputWriter(GetOutputDir(options)); } if (string.Equals("json", options.OutputType, StringComparison.InvariantCultureIgnoreCase)) { outputWriter = new JsonOutputWriter(GetOutputDir(options)); } if (outputWriter == null) { outputWriter = new KmlOutputWriter(GetOutputDir(options)); } Trace(service, options.VehicleId, outputWriter); Console.ReadKey(); } } }
public MapRouteStopsViewModel(IConfigManager configManager) { this.Stops = new ReadOnlyCollection <RouteStopMapViewModel>(_stops); _config = configManager.GetConfig(); this.LoadRouteStopsCommand = new MvxCommand(this.LoadRouteStops, () => _liveDataProvider != null); this.SelectRouteStopCommand = new MvxCommand <string>(this.SelectRouteStop); }
public MapVehiclesViewModel(IMvxMessenger messenger, IConfigManager configManager) { _messenger = messenger; _config = configManager.GetConfig(); _viewPortUpdateSubject = new Subject <VehiclesViewPortUpdate>(); this.ViewportUpdate = new Subject <VisibleVehiclesDelta>(); _updateVehicleLocationsSubscriptionToken = _messenger.Subscribe <VehicleLocationsUpdateRequestMessage>( message => this.ForceVehicleLocationsUpdate()); _subscription = _viewPortUpdateSubject.Throttle(TimeSpan.FromMilliseconds(200)) .Subscribe(this.UpdateVehiclesInTheViewPort); this.ForceVehicleLocationsUpdateCommand = new MvxCommand(this.ForceVehicleLocationsUpdate); this.SelectVehicleCommand = new MvxCommand <string>(this.SelectVehicle); }
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 void Setup() { _config = MainActivity.ConfigManager.GetConfig(); }