public void ShowRoute(MapPos startPos, MapPos stopPos) { // Run routing in background System.Threading.Tasks.Task.Run(() => { RoutingResult result = Routing.GetResult(startPos, stopPos); // Update response in UI thread RunOnUiThread(() => { if (result == null) { ContentView.Banner.Show("Routing failed"); return; } string text = Routing.GetMessage(result); ContentView.Banner.Show(text); Routing.Show(result); FeatureCollection collection = Routing.routeDataSource.GetFeatureCollection(); Search.FindAttractions(collection, (count) => { text = "Found " + count + " attractions. "; text += "Click on one to find out more about it"; RunOnUiThread(delegate { ContentView.Banner.Show(text); }); }); }); }); }
public void ShowRoute(MapPos startPos, MapPos stopPos) { // Run routing in background System.Threading.Tasks.Task.Run(() => { long time = Java.Lang.JavaSystem.CurrentTimeMillis(); RoutingResult result = Routing.GetResult(startPos, stopPos); // Update response in UI thread RunOnUiThread(() => { if (result == null) { Alert("Routing failed"); return; } Alert(Routing.GetMessage(result, time, Java.Lang.JavaSystem.CurrentTimeMillis())); Color lineColor = new Color(Colors.ActionBar); Routing.Show(result, lineColor); }); }); }
public void ShowRoute(MapPos startPos, MapPos stopPos) { // Run routing in background System.Threading.Tasks.Task.Run(() => { long time = DateTime.Now.Millisecond; RoutingResult result = Routing.GetResult(startPos, stopPos); // Update response in UI thread InvokeOnMainThread(() => { if (result == null) { Alert("Routing failed"); return; } Alert(Routing.GetMessage(result, time, DateTime.Now.Millisecond)); Color darkGray = new Carto.Graphics.Color(50, 50, 50, 255); Routing.Show(result, darkGray); }); }); }
public void ShowRoute(MapPos startPos, MapPos stopPos) { // Run routing in background System.Threading.Tasks.Task.Run(() => { long time = Java.Lang.JavaSystem.CurrentTimeMillis(); RoutingResult result = Routing.GetResult(startPos, stopPos); // Update response in UI thread RunOnUiThread(() => { if (result == null) { Alert("Routing failed"); return; } Alert(Routing.GetMessage(result, time, Java.Lang.JavaSystem.CurrentTimeMillis())); Color darkGray = new Carto.Graphics.Color(Android.Graphics.Color.DarkGray); Routing.Show(result, darkGray); }); }); }
public void ShowRoute(MapPos startPos, MapPos stopPos) { // Run routing in background System.Threading.Tasks.Task.Run(() => { long time = DateTime.Now.Millisecond; RoutingResult result = null; try { result = Routing.GetResult(startPos, stopPos); } catch (Exception e) { Console.WriteLine(e.Message); } // Update response in UI thread long now = DateTime.Now.Millisecond; InvokeOnMainThread(() => { if (result == null) { Alert("Routing failed. Have you downloaded offline package for the region?"); return; } Alert(Routing.GetMessage(result, time, now)); Color lineColor = new Color(0, 122, 255, 255); Routing.Show(result, lineColor); }); }); }