in src/ModernTacoShop/AndroidApp/AndroidApp.FrontEnd/MainActivity.cs [189:220]
private void DisplayCurrentOrderStatus(ModernTacoShop.TrackOrder.Protos.Order trackedOrder)
{
// Show the "reset" button if the order has completed.
if (trackedOrder.Status == ModernTacoShop.TrackOrder.Protos.OrderStatus.Delivered
|| trackedOrder.Status == ModernTacoShop.TrackOrder.Protos.OrderStatus.DeliveryError
|| trackedOrder.Status == ModernTacoShop.TrackOrder.Protos.OrderStatus.Cancelled)
{
var resetButton = FindViewById<FloatingActionButton>(Resource.Id.resetButton);
resetButton.Visibility = ViewStates.Visible;
}
var statusTextView = FindViewById<TextView>(Resource.Id.orderStatusTextView);
statusTextView.Text = $"Status: {trackedOrder.Status}";
// If there's no location data, don't try to update the map.
if (trackedOrder.LastPosition == null)
return;
// Show the order location on the map.
var mapControl = FindViewById<MapControl>(Resource.Id.mapControl);
var map = mapControl.Map;
mapControl.Visibility = ViewStates.Visible;
var orderPosition = SphericalMercator.FromLonLat(
double.Parse(trackedOrder.LastPosition.Longitude),
double.Parse(trackedOrder.LastPosition.Latitude));
OrderPositionLayer.GetFeatures().First().Geometry = orderPosition;
// Center the map on the order's current position.
mapControl.Navigator.NavigateTo(orderPosition, map.Resolutions[15]);
}