コード例 #1
0
        public override Fragment GetFragment(int row, int column)
        {
            var station = stations [row];
            var id      = station.Id;

            if (column == 1)
            {
                return(ActionButtonFragment.WithAction("Navigate", Resource.Drawable.navigate_button,
                                                       () => actions.NavigateToStation(id)));
            }
            if (column == 2)
            {
                return(ActionButtonFragment.WithToggleAction(Tuple.Create("Favorite", "Unfavorite"),
                                                             Resource.Drawable.favorite_button,
                                                             station.IsFavorite,
                                                             cked => actions.ToggleFavoriteStation(id, cked)));
            }

            return(stationFragments [row] ??
                   (stationFragments [row] = StationCardFragment.WithStation(station, actions.CurrentStatus)));
        }