Esempio n. 1
0
        /// <summary>
        /// Gets the current location.
        /// </summary>
        /// <returns>The current location.</returns>
        public async Task <TaxiPosition> GetCurrentLocation()
        {
            var position = await m_locator.GetPositionAsync(10000);

            m_currentTaxiPosition = new TaxiPosition(position.Latitude, position.Longitude);

            return(m_currentTaxiPosition);
        }
Esempio n. 2
0
        /// <summary>
        /// Moves the taxi.
        /// </summary>
        /// <returns>The new position.</returns>
        /// <param name="eventArgs">Event arguments.</param>
        TaxiPosition MoveTaxi(PositionEventArgs eventArgs)
        {
            var newTaxiPosition = new TaxiPosition(eventArgs.Position);

            Distance = TaxiPosition.DistanceInMetres(m_currentTaxiPosition.Latitude, m_currentTaxiPosition.Longitude, newTaxiPosition.Latitude, newTaxiPosition.Longitude);

            CalculateCurrentRunCost();

            OnTaxiMoved();

            m_currentTaxiPosition = newTaxiPosition;

            return(new TaxiPosition(eventArgs.Position.Latitude, eventArgs.Position.Longitude));
        }