Exemple #1
0
		public LeagueCardView(LeagueItem context)
		{
			BindingContext = context;

			Grid grid = new Grid {
				Padding = new Thickness(1,1,2,2),
				RowSpacing = 0,
				ColumnSpacing = 0,		
				BackgroundColor = Color.FromHex ("E3E3E3").MultiplyAlpha(0.5),
				RowDefinitions = {
					new RowDefinition { Height = new GridLength (100, GridUnitType.Absolute) }
				},
				ColumnDefinitions = {
					new ColumnDefinition { Width = new GridLength (4, GridUnitType.Absolute) },
					new ColumnDefinition {
						
					}
				}
			};

			grid.Children.Add (
				new FixtureCardStatusView ()
				,0,0);
			grid.Children.Add (new LeagueCardDetailsView (LeagueItem), 1, 0);

			var tgr = new TapGestureRecognizer { NumberOfTapsRequired = 1 };
			tgr.Tapped += (sender, args) => {
				OnCardClicked?.Invoke (LeagueItem);
			};
			grid.GestureRecognizers.Add (tgr);
			Content = grid;
		}
		public LeagueCardDetailsView (LeagueItem item)
		{
			BindingContext = item;

			_leagueNameLabel = new Label {
				Text = item.Text,
				FontSize = 15,
				FontFamily = "AvenirNext-DemiBold",
				TextColor = LeagueItem.Favorites.TextColor,
				HorizontalTextAlignment = TextAlignment.Center,
				IsEnabled = true,
				InputTransparent = true
			};

			_leagueCountryLabel = new Label {
				Text = item.Description,
				FontSize = 10,
				FontFamily = "AvenirNext-DemiBold",
				TextColor = LeagueItem.Favorites.DescriptionColor,
				HorizontalTextAlignment = TextAlignment.Center,
				IsEnabled = true,
				InputTransparent = true
			};

			_flagImage = new Image {
				Source = LeagueItem.Image,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Aspect = Aspect.AspectFill,
				WidthRequest = 120,
				HorizontalOptions = LayoutOptions.Start,
				IsEnabled = true,
				InputTransparent = true
			};

			Content = new StackLayout {
				HeightRequest = 100,
				HorizontalOptions = LayoutOptions.Fill,
				BackgroundColor = ScoresAppStyleKit.PageBackgroundColor,
				Orientation = StackOrientation.Horizontal,
				IsEnabled = true,
				InputTransparent = true,
				Children = {
					_flagImage,
					new StackLayout {
						Spacing = 5,
						HorizontalOptions = LayoutOptions.FillAndExpand,
						VerticalOptions = LayoutOptions.Center,
						Children = {
							_leagueNameLabel,
							_leagueCountryLabel
						},
						IsEnabled = true,
						InputTransparent = true
					}
				}
			};
		}
Exemple #3
0
		public void RemeveFromFavorite(LeagueItem item)
		{
			if (Favorites.FirstOrDefault (i => i.Id == item.Id) != null)
				Connection.Delete<LeagueItem> (item.Id);
			FavoritesViewModel.FavoritesViewModelManager.UpdateFavorites ();
		}
Exemple #4
0
		public void AddToFavorite(LeagueItem item)
		{
			if (Favorites.FirstOrDefault (i => i.Id == item.Id) == null)
				Connection.Insert (item);
			FavoritesViewModel.FavoritesViewModelManager.UpdateFavorites ();
		}
Exemple #5
0
		public bool IsFavorite(LeagueItem item)
		{
			var source = Favorites.FirstOrDefault( i => i.Id == item.Id);
			return source != null;
		}
Exemple #6
0
		void OnCardClicked(LeagueItem item)
		{
			Title = "";
			Navigation.PushAsync (new LeagueResultsPage (item), true);
		}
		public LeagueResultsPage (LeagueItem leagueItem)
		{
			BindingContext = leagueItem;
			Title = League.Text;
			BackgroundColor = ScoresAppStyleKit.PageBackgroundColor;
			CreateLayout ();
		}