示例#1
0
        async void OnItemSelected(object sender, EventArgs e)
        {
            BindableObject layout = (BindableObject)sender;

            PokeType pokeType = (PokeType)layout.BindingContext;
            await pokeType.LoadStrengths();

            TypeDetailViewModel typeDetailViewModel = new TypeDetailViewModel(pokeType);
            await Navigation.PushAsync(new TypeDetailPage(typeDetailViewModel));
        }
示例#2
0
        // Convert Type
        public TypeDetailViewModel ConvertType(CarType type)
        {
            // Get a list of cars
            var carlist = new List <CarDetailViewModel>();

            // But only set them if there are any
            carlist.AddRange(type.Cars?.Select(ConvertCar));

            // Set values to detail view
            var vm = new TypeDetailViewModel
            {
                Id    = type.Id,
                Brand = type.Brand,
                Model = type.Model,
                Cars  = carlist
            };

            return(vm);
        }
示例#3
0
        public TypeDetailPage(TypeDetailViewModel viewModel)
        {
            InitializeComponent();

            BindingContext = this.viewModel = viewModel;
        }