title: "invalid cross-thread access" when calculating a route - Windows phone 8
body: <p>i'm trying to show a route on a map, but i get this exception. i can't figure out why. 
  here is my codebehind:</p>
  
  <pre><code>public partial class map_new : PhoneApplicationPage
  {
      public GeoCoordinate destination;
      public GeoCoordinate myPosition;
      public Geolocator myGeolocator;
      List&lt;GeoCoordinate&gt; waypoints = new List&lt;GeoCoordinate&gt;();
      public RouteQuery routeQuery;
  
  
      public map_new()
      {
          InitializeComponent();
          destination = new GeoCoordinate(41.909859, 12.461792);
          ShowDestinationLocationOnTheMap();
  
          myGeolocator = new Geolocator();
          myGeolocator.DesiredAccuracy = PositionAccuracy.High;
          myGeolocator.MovementThreshold = 20; // The units are meters.
          myGeolocator.StatusChanged+=geolocator_StatusChanged;
  
  
      }
  
      private async Task update_position() 
      {
          Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
          Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
          myPosition = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);
          Dispatcher.BeginInvoke(() =&gt;
          {
              this.myMap.Center = myPosition;
              this.myMap.ZoomLevel = 16;
          });
          //update_route();
      }
  
      private async void update_route()
      {
          await update_position();
          RouteQuery routeQuery = new RouteQuery();
          waypoints.Add(myPosition);
          waypoints.Add(destination);
          routeQuery.Waypoints = waypoints;
          routeQuery.QueryCompleted += routeQuery_QueryCompleted;
          routeQuery.QueryAsync();
      }
  
      void routeQuery_QueryCompleted(object sender, QueryCompletedEventArgs&lt;Route&gt; e)
      {
          if (e.Error == null)
          {
              Route MyRoute = e.Result;
              MapRoute MyMapRoute = new MapRoute(MyRoute);
              myMap.AddRoute(MyMapRoute);
              routeQuery.Dispose();
          }
      }
  
      void geolocator_StatusChanged(Geolocator sender, StatusChangedEventArgs args)
      {
          string status = "";
  
          switch (args.Status)
          {
  
              case PositionStatus.Ready:
                  // the location service is generating geopositions as specified by the tracking parameters
                  status = "ready";
                  update_route();
                  break;
  
      }
  </code></pre>
  
  <p>i think the error is that update_route() don't wait for update_position() to be completed, but i don't how to set update_route() to wait.
  any idea?</p>
  
  <p>EDIT: after applying KooKiz and Stephen solution the error is located on this line:</p>
  
  <pre><code>RouteQuery routeQuery = new RouteQuery();
  </code></pre>