RoverOperator.Content.GPSViewViewModel.setRoverPinLocation C# (CSharp) Method

setRoverPinLocation() private method

(DEPRECATED) Binds the rover location data being sent by StatusUpdater to PushPin on the Map
private setRoverPinLocation ( ) : void
return void
        private void setRoverPinLocation()
        {
            bool messageReceived = false;
            var startTime = DateTime.UtcNow;

            roverCoordinates = new GPSCoordinates();
            roverPin = new Pushpin();

            //Wait for the StatusUpdater to send the location of the rover BEFORE the pushpin is set, or else DataBinding will not occur
            while (roverCoordinates.Location == null && (DateTime.UtcNow - startTime < TimeSpan.FromSeconds(2)))
            {
                //loop until the rover coordinates have been received, timeout after 2 seconds
                messageReceived = true;
            }

            //if the message was successfully received, bind the location
            if (messageReceived)
            {
                roverPin.Location = roverCoordinates.Location;

                formatRoverPin();
            }
        }