示例#1
0
 public GeolocService(IGeocoding geocoding, IAddresses addresses, IDirections directions, INetworkRoamingService networkRoamingService)
 {
     _directions            = directions;
     _networkRoamingService = networkRoamingService;
     _addresses             = addresses;
     _geocoding             = geocoding;
 }
示例#2
0
 public DirectionsService(IDirections client, IServerSettings serverSettings, IOrderDao orderDao, VehicleService vehicleService, ILogger logger, ICommandBus commandBus, ITaxiHailNetworkServiceClient networkServiceClient)
 {
     _client               = client;
     _serverSettings       = serverSettings;
     _orderDao             = orderDao;
     _vehicleService       = vehicleService;
     _logger               = logger;
     _commandBus           = commandBus;
     _networkServiceClient = networkServiceClient;
 }
示例#3
0
        /// <summary>
        /// Constructor of RoutenViewModel
        /// </summary>
        /// <param name="geoCoding"></param>
        /// <param name="staticMaps"></param>
        public RoutenViewModel(IGeoCoding geoCoding, IStaticMaps staticMaps, IDirections directions)
        {
            this.geoCoding  = geoCoding;
            this.staticMaps = staticMaps;
            this.directions = directions;

            OriginChanging = new EventOriginChanging();
            OriginChanging.OriginChangingEvent += OnOriginChanging;

            DestinationChanging = new EventDestinationChanging();
            DestinationChanging.DestinationChangingEvent += OnDesinationChanging;

            DisplayMapCommand        = new DelegateCommand(DisplayMap, CanDisplayMap);
            DisplayDirectionsCommand = new DelegateCommand(DisplayDirections, CanDisplayDirections);
            ClearFieldsCommand       = new DelegateCommand(ClearFields, CanClearFields);

            RoutenModel = new RoutenModel(OriginChanging, DestinationChanging)
            {
                Origin      = "Breiteweg 17, 30, 06 Bern",
                Waypoint    = "Ziegelfeldstrasse, 4600 Olten",
                Destination = "Zürich Flughafen, 8302 Kloten"
            };
        }
示例#4
0
        public VehicleService(IOrderWorkflowService orderWorkflowService,
                              IDirections directions,
                              IAppSettings settings)
        {
            _directions = directions;
            _settings   = settings;

            // having publish and connect fixes the problem that caused the code to be executed 2 times
            // because there was 2 subscriptions
            _availableVehiclesObservable = _timerSubject
                                           .Switch()
                                           .CombineLatest(
                orderWorkflowService.GetAndObservePickupAddress(),
                _availableVehicleEnabled.DistinctUntilChanged(),
                (_, address, enableAvailableVehicle) => new { address, enableAvailableVehicle }
                )
                                           .Where(x => x.enableAvailableVehicle && x.address.HasValidCoordinate())
                                           .Select(x => x.address)
                                           .SelectMany(async x =>
            {
                var vehicleTypeId = await orderWorkflowService.GetAndObserveVehicleType()
                                    .Take(1)
                                    .ToTask()
                                    .ConfigureAwait(false);

                return(await CheckForAvailableVehicles(x, vehicleTypeId).ConfigureAwait(false));
            })
                                           .Publish();
            _availableVehiclesObservable.Connect();

            _availableVehiclesWhenTypeChangesObservable = orderWorkflowService.GetAndObserveVehicleType()
                                                          .SelectMany(async vehicleTypeId =>
            {
                var address = await orderWorkflowService.GetAndObservePickupAddress()
                              .Take(1)
                              .ToTask()
                              .ConfigureAwait(false);

                return(new { vehicleTypeId, address });
            })
                                                          .Where(x => x.address.HasValidCoordinate())
                                                          .SelectMany(x => CheckForAvailableVehicles(x.address, x.vehicleTypeId));

            _isUsingGeoServicesObservable = orderWorkflowService.GetAndObserveIsUsingGeo();

            _etaObservable = _availableVehiclesObservable
                             .Where(_ => _settings.Data.ShowEta)
                             .CombineLatest(
                _isUsingGeoServicesObservable,
                orderWorkflowService.GetAndObservePickupAddress(),
                (vehicles, isUsingGeoServices, address) => new { address, isUsingGeoServices, vehicles }
                )
                             .Select(x => new { x.address, x.isUsingGeoServices, vehicle = GetNearestVehicle(x.isUsingGeoServices, x.address, x.vehicles) })
                             .DistinctUntilChanged(x =>
            {
                if (x.isUsingGeoServices && x.vehicle != null)
                {
                    return(x.vehicle.Eta ?? double.MaxValue);
                }

                return(x.vehicle == null
                                        ? double.MaxValue
                                        : Position.CalculateDistance(x.vehicle.Latitude, x.vehicle.Longitude, x.address.Latitude, x.address.Longitude));
            })
                             .SelectMany(x => CheckForEta(x.isUsingGeoServices, x.address, x.vehicle));
        }
示例#5
0
文件: Rules.cs 项目: urise/Checkers
 public Rules(IPosition position, IBoardGeometry boardGeometry, IDirections directions)
 {
     _position = position;
     _boardGeometry = boardGeometry;
     _directions = directions;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="geoCoding"></param>
 /// <param name="staticMaps"></param>
 /// <param name="directions"></param>
 public RoutenView(IGeoCoding geoCoding, IStaticMaps staticMaps, IDirections directions)
 {
     InitializeComponent();
     DataContext          = new RoutenViewModel(geoCoding, staticMaps, directions);
     DataGrid.DataContext = DataContext;
 }