public GMapMarker GenerateMapAirplaneMarkers(FlightData flight, out MarkerErrorCode errorCode)
        {
            BitmapImage airplaneMarker = new BitmapImage();
            GMapMarker  marker         = new GMapMarker(new PointLatLng(0, 0));

            try
            {
                airplaneMarker.BeginInit();
                airplaneMarker.UriSource = new Uri(@"\Resources\plane.png", UriKind.Relative);
                switch (flight.geography.direction)
                {
                case double d when(d > 45 && d <= 135):
                    airplaneMarker.Rotation = Rotation.Rotate270;

                    break;

                case double d when(d > 135 && d <= 225):
                    airplaneMarker.Rotation = Rotation.Rotate180;

                    break;

                case double d when(d > 225 && d <= 315):
                    airplaneMarker.Rotation = Rotation.Rotate90;

                    break;

                default:
                    break;
                }
                airplaneMarker.EndInit();
                marker.Position = new PointLatLng(flight.geography.latitude, flight.geography.longitude);
                Image image = new Image();
                image.Source = airplaneMarker;
                //size image
                image.Height = 20;
                image.Width  = 20;
                //set the marker shape to the image
                marker.Shape = image;
                errorCode    = MarkerErrorCode.VALID;
            }
            catch (Exception)
            {
                errorCode = MarkerErrorCode.INVALID;
            }

            return(marker);
        }
        public GMapPolygon GenerateMapRoutesFromCurrentToArv(FlightData flight, List <Airport> airportList, out MarkerErrorCode errorCode)
        {
            //Declare List for pointlatlang
            List <PointLatLng> pointlatlang = new List <PointLatLng>();

            try
            {
                string flightCurrentLocationLat  = flight.geography.latitude.ToString();
                string flightCurrentLocationLong = flight.geography.longitude.ToString();
                string arrivalLocationLat        = airportList.Find(a => a.code == flight.arrival.icaoCode).lat;
                string arrivalLocationLong       = airportList.Find(a => a.code == flight.arrival.icaoCode).lon;

                pointlatlang.Add(new PointLatLng(double.Parse(flightCurrentLocationLat), double.Parse(flightCurrentLocationLong)));
                pointlatlang.Add(new PointLatLng(double.Parse(arrivalLocationLat), double.Parse(arrivalLocationLong)));
                errorCode = MarkerErrorCode.VALID;
            }
            catch (Exception)
            {
                errorCode = MarkerErrorCode.INVALID;
            }

            GMapPolygon polygon = new GMapPolygon(pointlatlang);

            return(polygon);
        }
        public GMapMarker GenerateDestinationMarkers(FlightData flight, List <Airport> airportList, out MarkerErrorCode error)
        {
            GMapMarker marker = new GMapMarker(new PointLatLng(0, 0));

            try
            {
                Image image = new Image();
                image.Source = new BitmapImage(new Uri(@"\Resources\destinationMarker.png", UriKind.Relative));
                string arrivalLocationLat  = airportList.Find(a => a.code == flight.arrival.icaoCode).lat;
                string arrivalLocationLong = airportList.Find(a => a.code == flight.arrival.icaoCode).lon;
                marker.Position = new PointLatLng(double.Parse(arrivalLocationLat), double.Parse(arrivalLocationLong));
                //size image
                image.Height = 15;
                image.Width  = 15;
                //set the marker shape to the image
                marker.Shape = image;
                error        = MarkerErrorCode.VALID;
            }
            catch (Exception)
            {
                error = MarkerErrorCode.INVALID;
            }

            return(marker);
        }