Pregunta

I'm trying to save coordinates to a list of some type so that I can store them for future manipulation within the application but I'm not sure how I would go about this. In the onNavigatedTo method of the application I have a GeoCoordinate variable MyGeoPosition that I want to store.

Can someone show me how I would achieve this and what type of list to use for this issue?

This is the complete method:

protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (NavigationContext.QueryString.ContainsKey("GeoLat") && NavigationContext.QueryString.ContainsKey("GeoLong") && NavigationContext.QueryString.ContainsKey("pName"))
            {
                var latitude = Convert.ToDouble(NavigationContext.QueryString["GeoLat"]);
                var longtitude = Convert.ToDouble(NavigationContext.QueryString["GeoLong"]);
                var MyGeoPosition = new GeoCoordinate(latitude, longtitude);
                var pushPinName = NavigationContext.QueryString["pName"];

                DrawPushPin(MyGeoPosition,pushPinName);

            }

            base.OnNavigatedTo(e);
        }
¿Fue útil?

Solución

List<GeoCoordinate> mycoord = new List<GeoCoordinate>();
mycoord.add(MyGeoPosition);

But you need to write mycoord as class member, not as automatic variable.

Otros consejos

You should just use a list of type

var mycoord = new List<GeoCoordinate>();
mycoord.Add(mycoord);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top