private void Route_Click(object sender, RoutedEventArgs e) { LayoutRoot.RowDefinitions[1].Height = new GridLength(LayoutRoot.RowDefinitions[1].MinHeight); /* * RouteServiceClient client = new RouteServiceClient("BasicHttpBinding_IRouteService"); * RouteRequest request = new RouteRequest(); * request.Waypoints = new List<Waypoint>(); * request.Waypoints.Add(new Waypoint()); * request.Waypoints.Add(new Waypoint()); * * request.Credentials = new Credentials(); * request.Credentials.ApplicationId = BingMapsApiKey; * request.Waypoints[0].Location = new Location(); * request.Waypoints[1].Location = new Location(); * * request.Waypoints[0].Location.Latitude = DataContextManager.SelectedCommute.StartPoint.Location.Latitude; * request.Waypoints[0].Location.Longitude = DataContextManager.SelectedCommute.StartPoint.Location.Longitude; * request.Waypoints[1].Location.Latitude = DataContextManager.SelectedCommute.EndPoint.Location.Latitude; * request.Waypoints[1].Location.Longitude = DataContextManager.SelectedCommute.EndPoint.Location.Longitude; * * // Only accept results with high confidence. * request.Options = new RouteOptions(); * request.Options.RoutePathType = RoutePathType.Points; * * client.CalculateRouteCompleted += new EventHandler<CalculateRouteCompletedEventArgs>(client_CalculateRouteCompleted); * client.CalculateRouteAsync(request); */ AsyncTask.Execute(this.Dispatcher, delegate() { _loadedRoute = Utils.RefreshRoute(DataContextManager.SelectedCommute.StartPoint, DataContextManager.SelectedCommute.EndPoint, DataContextManager.SelectedRoute, false); }, (ex) => RouteComplete(ex)); }
void PerformRouting(bool setViewPort) { _setViewPort = setViewPort; AsyncTask.Execute(this.Dispatcher, delegate() { _loadedRoute = Utils.RefreshRoute(DataContextManager.SelectedCommute.StartPoint, DataContextManager.SelectedCommute.EndPoint, DataContextManager.SelectedRoute, false); /* * RouteServiceClient client = new RouteServiceClient("BasicHttpBinding_IRouteService"); * RouteRequest request = new RouteRequest(); * request.Waypoints = new List<Waypoint>(); * request.Waypoints.Add(new Waypoint()); * * request.Credentials = new Credentials(); * request.Credentials.ApplicationId = BingMapsApiKey; * request.Waypoints[0].Location = new Location(); * * request.Waypoints[0].Location.Latitude = DataContextManager.SelectedCommute.StartPoint.Location.Latitude; * request.Waypoints[0].Location.Longitude = DataContextManager.SelectedCommute.StartPoint.Location.Longitude; * * foreach (MobileSrc.Commuter.Shared.RouteLocation wayPoint in DataContextManager.SelectedRoute.WayPoints) * { * request.Waypoints.Add(new Waypoint()); * request.Waypoints[request.Waypoints.Count - 1].Location = new Location(); * request.Waypoints[request.Waypoints.Count - 1].Location.Latitude = wayPoint.Location.Latitude; * request.Waypoints[request.Waypoints.Count - 1].Location.Longitude = wayPoint.Location.Longitude; * } * * request.Waypoints.Add(new Waypoint()); * request.Waypoints[request.Waypoints.Count - 1].Location = new Location(); * request.Waypoints[request.Waypoints.Count - 1].Location.Latitude = DataContextManager.SelectedCommute.EndPoint.Location.Latitude; * request.Waypoints[request.Waypoints.Count - 1].Location.Longitude = DataContextManager.SelectedCommute.EndPoint.Location.Longitude; * * // Only accept results with high confidence. * request.Options = new RouteOptions(); * request.Options.RoutePathType = RoutePathType.Points; * request.Options.TrafficUsage = TrafficUsage.TrafficBasedTime; */ }, (ex) => RouteComplete(ex) ); }
private void Route_Click(object sender, RoutedEventArgs e) { LayoutRoot.RowDefinitions[1].Height = new GridLength(LayoutRoot.RowDefinitions[1].MinHeight); /* RouteServiceClient client = new RouteServiceClient("BasicHttpBinding_IRouteService"); RouteRequest request = new RouteRequest(); request.Waypoints = new List<Waypoint>(); request.Waypoints.Add(new Waypoint()); request.Waypoints.Add(new Waypoint()); request.Credentials = new Credentials(); request.Credentials.ApplicationId = BingMapsApiKey; request.Waypoints[0].Location = new Location(); request.Waypoints[1].Location = new Location(); request.Waypoints[0].Location.Latitude = DataContextManager.SelectedCommute.StartPoint.Location.Latitude; request.Waypoints[0].Location.Longitude = DataContextManager.SelectedCommute.StartPoint.Location.Longitude; request.Waypoints[1].Location.Latitude = DataContextManager.SelectedCommute.EndPoint.Location.Latitude; request.Waypoints[1].Location.Longitude = DataContextManager.SelectedCommute.EndPoint.Location.Longitude; // Only accept results with high confidence. request.Options = new RouteOptions(); request.Options.RoutePathType = RoutePathType.Points; client.CalculateRouteCompleted += new EventHandler<CalculateRouteCompletedEventArgs>(client_CalculateRouteCompleted); client.CalculateRouteAsync(request); */ AsyncTask.Execute(this.Dispatcher, delegate() { _loadedRoute = Utils.RefreshRoute(DataContextManager.SelectedCommute.StartPoint, DataContextManager.SelectedCommute.EndPoint, DataContextManager.SelectedRoute, false); }, (ex) => RouteComplete(ex)); }
void PerformRouting(bool setViewPort) { _setViewPort = setViewPort; AsyncTask.Execute(this.Dispatcher, delegate() { _loadedRoute = Utils.RefreshRoute(DataContextManager.SelectedCommute.StartPoint, DataContextManager.SelectedCommute.EndPoint, DataContextManager.SelectedRoute, false); /* RouteServiceClient client = new RouteServiceClient("BasicHttpBinding_IRouteService"); RouteRequest request = new RouteRequest(); request.Waypoints = new List<Waypoint>(); request.Waypoints.Add(new Waypoint()); request.Credentials = new Credentials(); request.Credentials.ApplicationId = BingMapsApiKey; request.Waypoints[0].Location = new Location(); request.Waypoints[0].Location.Latitude = DataContextManager.SelectedCommute.StartPoint.Location.Latitude; request.Waypoints[0].Location.Longitude = DataContextManager.SelectedCommute.StartPoint.Location.Longitude; foreach (MobileSrc.Commuter.Shared.RouteLocation wayPoint in DataContextManager.SelectedRoute.WayPoints) { request.Waypoints.Add(new Waypoint()); request.Waypoints[request.Waypoints.Count - 1].Location = new Location(); request.Waypoints[request.Waypoints.Count - 1].Location.Latitude = wayPoint.Location.Latitude; request.Waypoints[request.Waypoints.Count - 1].Location.Longitude = wayPoint.Location.Longitude; } request.Waypoints.Add(new Waypoint()); request.Waypoints[request.Waypoints.Count - 1].Location = new Location(); request.Waypoints[request.Waypoints.Count - 1].Location.Latitude = DataContextManager.SelectedCommute.EndPoint.Location.Latitude; request.Waypoints[request.Waypoints.Count - 1].Location.Longitude = DataContextManager.SelectedCommute.EndPoint.Location.Longitude; // Only accept results with high confidence. request.Options = new RouteOptions(); request.Options.RoutePathType = RoutePathType.Points; request.Options.TrafficUsage = TrafficUsage.TrafficBasedTime; */ }, (ex) => RouteComplete(ex) ); }