Exemplo n.º 1
0
        private void ShowRouteDetails(RoutesListItemViewModel routeVM)
        {
            if (routeVM.Routes.Count > 1)
            {
                var routeListNavParam = new RouteListNavParam();
                foreach (var route in routeVM.Routes)
                {
                    routeListNavParam.Routes.Add(
                        new RouteListItem(
                            route.Id,
                            route.Name,
                            route.Number,
                            $"{route.FirstStop.Name} — {route.LastStop.Name}",
                            route.VehicleType));
                }

                this.ShowViewModel <SetRouteViewModel>(new { routes = JsonConvert.SerializeObject(routeListNavParam) });
            }
            else
            {
                this.ShowViewModel <RouteVehiclesViewModel>(new
                {
                    routeId     = routeVM.Routes.First().Id,
                    routeName   = routeVM.Name,
                    routeNumber = routeVM.Routes.First().Number,
                    vehicleType = routeVM.VehicleType
                });
            }
        }
Exemplo n.º 2
0
 public void Init(string routes)
 {
     try
     {
         _routesListNavParam = JsonConvert.DeserializeObject <RouteListNavParam>(routes);
         if (_routesListNavParam?.Routes != null && _routesListNavParam.Routes.Any())
         {
             foreach (var route in _routesListNavParam.Routes)
             {
                 _routesObservable.Add(route.Stops);
             }
         }
     }
     catch (Exception e)
     {
         MvxTrace.Trace("An error occurred while deserializing route list: {0}", e);
     }
 }