Esempio n. 1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string result = "<not set>";

            if (value is GPSCoordinates gpsCoordinates)
            {
                var cpLat       = GPSCoordinatesHelper.GetPosition(gpsCoordinates.Latitude, E_CoordinateType.Latitude);
                var cpLatString = new GPSCoordinatesHelper(gpsCoordinates.Latitude, cpLat).ToString();

                var cpLong       = GPSCoordinatesHelper.GetPosition(gpsCoordinates.Longitude, E_CoordinateType.Longitude);
                var cpLongString = new GPSCoordinatesHelper(gpsCoordinates.Longitude, cpLong).ToString();

                result = cpLatString + " " + cpLongString;
            }

            return(result);
        }
Esempio n. 2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string convertedValue = "<not set>";

            if (value != null)
            {
                // convert parameter
                double doubleValue    = System.Convert.ToDouble(value);
                var    coordinateType = (E_CoordinateType)parameter;

                // determinate coordinate type (E, W, S, N)
                var cp = GPSCoordinatesHelper.GetPosition(doubleValue, coordinateType);

                // return the converted string value
                convertedValue = new GPSCoordinatesHelper(doubleValue, cp).ToString();
            }

            return(convertedValue);
        }