Пример #1
0
        private List <CapturedLocation> GetCapturedLocations()
        {
            if (_locationListener == null)
            {
                throw new InvalidOperationException("Location listener has no been initialized");
            }

            return(_locationListener.GetCapturedLocations());
        }
Пример #2
0
 public void StartShipmentTracking(Guid transportationId)
 {
     _configurationService.SetCurrentTransportationId(transportationId);
     _locationListener = new LocationListener();
     _locationManager.RequestLocationUpdates(_locationProvider, 1000, 0, _locationListener);
     _locationCommunicationTimer = new Timer {
         Interval = 2000
     };
     _locationCommunicationTimer.Elapsed += async delegate
     {
         var capturedLocations = _locationListener.GetCapturedLocations();
         if (capturedLocations.Any())
         {
             await _apiService.PostCapturedLocations(transportationId, capturedLocations);
         }
     };
     _locationCommunicationTimer.Start();
 }