Exemplo n.º 1
0
 public LeagueResultsPage(LeagueItem leagueItem)
 {
     BindingContext  = leagueItem;
     Title           = League.Text;
     BackgroundColor = ScoresAppStyleKit.PageBackgroundColor;
     CreateLayout();
 }
Exemplo n.º 2
0
        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
                    }
                }
            };
        }
Exemplo n.º 3
0
 public void RemeveFromFavorite(LeagueItem item)
 {
     if (Favorites.FirstOrDefault(i => i.Id == item.Id) != null)
     {
         Connection.Delete <LeagueItem> (item.Id);
     }
     FavoritesViewModel.FavoritesViewModelManager.UpdateFavorites();
 }
Exemplo n.º 4
0
 public void AddToFavorite(LeagueItem item)
 {
     if (Favorites.FirstOrDefault(i => i.Id == item.Id) == null)
     {
         Connection.Insert(item);
     }
     FavoritesViewModel.FavoritesViewModelManager.UpdateFavorites();
 }
Exemplo n.º 5
0
        private async void LeaguesListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (LeaguesListView.SelectedItem != null)
            {
                LeagueItem item = (LeagueItem)LeaguesListView.SelectedItem;
                PlayerLabel.Content = item.PlayerLabel.Content;
                var x = await Client.PVPNet.GetSummonerByName((string)item.PlayerLabel.Content);

                Client.PVPNet.GetAggregatedStats(x.AcctId, "CLASSIC", "3", new AggregatedStats.Callback(GotStats));
            }
        }
Exemplo n.º 6
0
        public void RenderLeague()
        {
            LeaguesListView.Items.Clear();
            foreach (LeagueListDTO leagues in MyLeagues.SummonerLeagues)
            {
                if (leagues.Queue == Queue)
                {
                    if (SelectedRank == "V")
                    {
                        UpTierButton.IsEnabled   = true;
                        DownTierButton.IsEnabled = false;
                    }
                    else if (SelectedRank == "I")
                    {
                        UpTierButton.IsEnabled   = false;
                        DownTierButton.IsEnabled = true;
                    }
                    else
                    {
                        UpTierButton.IsEnabled   = true;
                        DownTierButton.IsEnabled = true;
                    }

                    CurrentLeagueLabel.Content     = leagues.Tier + " " + SelectedRank;
                    CurrentLeagueNameLabel.Content = leagues.Name;
                    List <LeagueItemDTO> players = leagues.Entries.OrderBy(o => o.LeaguePoints).Where(item => item.Rank == SelectedRank).ToList();
                    players.Reverse();
                    int i = 0;
                    foreach (LeagueItemDTO player in players)
                    {
                        i++;
                        LeagueItem item = new LeagueItem();
                        item.DataContext         = player;
                        item.PlayerLabel.Content = player.PlayerOrTeamName;

                        item.PlayerRankLabel.Content = i;
                        if (i - player.PreviousDayLeaguePosition != 0)
                        {
                            item.RankChangeLabel.Content = i - player.PreviousDayLeaguePosition;
                        }

                        //TypedObject miniSeries = player.MiniSeries as TypedObject;
                        //if (miniSeries != null)
                        //    item.LPLabel.Content = ((string)miniSeries["progress"]).Replace('N', '-');

                        LeaguesListView.Items.Add(item);
                    }
                }
            }
            LeaguesListView.SelectedIndex = 0;
        }
Exemplo n.º 7
0
        private async void LeaguesListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (LeaguesListView.SelectedItem != null)
            {
                LeagueItem item = (LeagueItem)LeaguesListView.SelectedItem;
                TopChampionsListView.Items.Clear();
                PublicSummoner x = await RiotCalls.GetSummonerByName((string)item.PlayerLabel.Content);

                AggregatedStats stats = await RiotCalls.GetAggregatedStats(x.AcctId, "CLASSIC", Client.LoginPacket.ClientSystemStates.currentSeason.ToString());

                GotStats(stats);
                PlayerLabel.Content = item.PlayerLabel.Content;
            }
        }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
0
        public void RenderLeague()
        {
            LeaguesListView.Items.Clear();
            foreach (var leagues in _myLeagues.SummonerLeagues.Where(leagues => leagues.Queue == _queue))
            {
                switch (_selectedRank)
                {
                case "V":
                    UpTierButton.IsEnabled   = true;
                    DownTierButton.IsEnabled = false;
                    break;

                case "I":
                    UpTierButton.IsEnabled   = false;
                    DownTierButton.IsEnabled = true;
                    break;

                default:
                    UpTierButton.IsEnabled   = true;
                    DownTierButton.IsEnabled = true;
                    break;
                }

                CurrentLeagueLabel.Content     = leagues.Tier + " " + _selectedRank;
                CurrentLeagueNameLabel.Content = leagues.Name;
                var players =
                    leagues.Entries.OrderBy(o => o.LeaguePoints).Where(item => item.Rank == _selectedRank).ToList();
                players.Reverse();
                var i = 0;
                foreach (var player in players)
                {
                    i++;
                    var item = new LeagueItem
                    {
                        PlayerRankLabel = { Content = i }
                    };
                    if (i - player.PreviousDayLeaguePosition != 0)
                    {
                        item.RankChangeLabel.Content = i - player.PreviousDayLeaguePosition;
                    }

                    item.PlayerLabel.Content = player.PlayerOrTeamName;
                    if (player.FreshBlood)
                    {
                        item.RecruitLabel.Visibility = Visibility.Visible;
                    }

                    if (player.Veteran)
                    {
                        item.VeteranLabel.Visibility = Visibility.Visible;
                    }

                    if (player.HotStreak)
                    {
                        item.HotStreakLabel.Visibility = Visibility.Visible;
                    }

                    item.WinsLabel.Content = player.Wins;
                    item.LpLabel.Content   = player.LeaguePoints;

                    var miniSeries = player.MiniSeries as TypedObject;
                    if (miniSeries != null)
                    {
                        item.LpLabel.Content = ((string)miniSeries["progress"]).Replace('N', '-');
                    }

                    LeaguesListView.Items.Add(item);
                }
            }
            LeaguesListView.SelectedIndex = 0;
        }
Exemplo n.º 10
0
        public bool IsFavorite(LeagueItem item)
        {
            var source = Favorites.FirstOrDefault(i => i.Id == item.Id);

            return(source != null);
        }
Exemplo n.º 11
0
 void OnCardClicked(LeagueItem item)
 {
     Title = "";
     Navigation.PushAsync(new LeagueResultsPage(item), true);
 }