Beispiel #1
0
    public static void Main()
    {
        LocationSimulator simulator = LocationSimulator.SetStartingLocation();

        // Subscribe with class that implements IObserver<Location>
        IDisposable d = simulator.Subscribe(new LocationDisplay());
        Location    loc;

        do
        {
            loc = simulator.GetCurrentLocation();
            Thread.Sleep(2500);
        } while (loc.Status != LocationStatus.Finished);
    }
Beispiel #2
0
        public override async Task StartGuide(CancellationToken token)
        {
            await base.StartGuide(token);

            _simulator = SystemFactory.Instance.CreateLocationSimulator(DebugRoutePolyline.Polyline ?? _drivingRouteObject.Route.Geometry);

            var speedAndEnabledStream = _debugRepository.LocationSimulationEnabled
                                        .CombineLatest(_debugRepository.LocationSimulationSpeedInKmph.Throttle(TimeSpan.FromSeconds(0.3), _concurrencyService.TaskPool),
                                                       (enabled, speed) => new { enabled, speed })
                                        .ObserveOn(_concurrencyService.Dispatcher);

            _debugSubscription?.Dispose();
            _debugSubscription = new CompositeDisposable(speedAndEnabledStream.Subscribe(p => OnSimulationSetingsChanged(p.enabled, p.speed)));
        }