示例#1
0
        private static void SetupChampionList()
        {
            var championListWindow = new FrameView("Champions")
            {
                X = Pos.Percent(0),
                Y = Pos.Percent(10) + 1, // Leave place for top level menu and Summoner search

                // By using Dim.Fill(), it will automatically resize without manual intervention
                Width  = Dim.Percent(20),
                Height = Dim.Fill()
            };

            ChampionsView = championListWindow;


            var championsListView = new ListView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            championsListView.AllowsMultipleSelection = true;
            championsListView.AllowsMarking           = true;
            championsListView.SetSource(LeagueUtilities.GetChampionListElements());
            ChampionsListView = championsListView;
            ChampionsView.Add(championsListView);
        }
示例#2
0
        private static void SearchButtonClickedHandler()
        {
            PlayerSummoner = null;
            try
            {
                PlayerSummoner = LeagueUtilities.Api.Summoner.GetSummonerByNameAsync(SearchRegion, UsernameTextField.Text.ToString()).Result;
            }
            catch (Exception e)
            {
                DrawInfoDialog("There is no summoner " + UsernameTextField.Text.ToString() + " in selected region");
                return;
            }


            var summonerLeagues = LeagueUtilities.Api.League.GetLeagueEntriesBySummonerAsync(SearchRegion, PlayerSummoner.Id).Result;

            List <MatchHistoryElement> matchlist = null;

            try
            {
                matchlist = LeagueUtilities.GetMatchHistoryList(LeagueUtilities.Api, SearchRegion, PlayerSummoner, LeagueUtilities.Champions);
            }
            catch (Exception e)
            {
                DrawInfoDialog("This user hasn't play any games this season.");
                return;
            }


            //List<ChampionMastery> championMasteries;
            //try
            //{
            //    championMasteries = Api.ChampionMastery.GetChampionMasteriesAsync(SearchRegion, summoner.Id).Result.Where(x =>;
            //}
            //catch (RiotSharpException ex)
            //{
            //    // Handle the exception however you want.
            //    return;
            //}

            RedrawUserInfo(summonerLeagues);
            RedrawMatchHistory(matchlist);
        }
示例#3
0
        private static void SetupItemList()
        {
            var itemListWindow = new FrameView("Items")
            {
                X = Pos.Percent(20),
                Y = Pos.Percent(10) + 1, // Leave place for top level menu and Summoner search

                // By using Dim.Fill(), it will automatically resize without manual intervention
                Width  = Dim.Percent(30),
                Height = Dim.Fill()
            };

            ItemListWindow = itemListWindow;


            var itemListView = new ListView()
            {
                X      = 0,
                Y      = 0,
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            itemListView.SetSource(LeagueUtilities.GetItemListElements());
            ItemListView = itemListView;

            ItemListWindow.Add(itemListView);
            itemListView.SelectedItemChanged += SetItemDetails;
            itemListView.OpenSelectedItem    += ItemListView_OpenSelectedItem;
            //ItemView.ColorScheme = Colors.Dialog;
            //for (int i = 0; i < championsListView.Source.Count-1; i++)
            //{
            //    if (championsListView.Source.IsMarked(i))
            //    {
            //        championsListView.Source.ToList()[i]
            //    }
            //}
        }
示例#4
0
        private static void RedrawUserInfo(List <LeagueEntry> summonerLeagues)
        {
            SummonerInfoView.RemoveAll();

            var label = new Label("Summoner Name: " + PlayerSummoner.Name)
            {
                X      = Pos.Percent(0),
                Y      = Pos.Percent(0),
                Width  = Dim.Fill(),
                Height = 1
            };

            SummonerInfoView.Add(label);

            var levelLabel = new Label("Summoner level: " + PlayerSummoner.Level)
            {
                X      = Pos.Percent(0),
                Y      = Pos.Bottom(label),
                Width  = Dim.Fill(),
                Height = 1
            };

            SummonerInfoView.Add(levelLabel);


            var emptylabel = new Label(" ")
            {
                X      = Pos.Percent(0),
                Y      = Pos.Bottom(levelLabel),
                Width  = Dim.Fill(),
                Height = 1
            };

            SummonerInfoView.Add(emptylabel);

            var queue = new Label("Queue")
            {
                X      = Pos.Percent(0),
                Y      = Pos.Bottom(emptylabel),
                Width  = Dim.Fill(),
                Height = 1
            };

            SummonerInfoView.Add(queue);

            var prev = queue;

            foreach (LeagueEntry entry in summonerLeagues)
            {
                var queueType = new Label(string.Format("{0,-15} | {1,-15} | {2,-15}", entry.QueueType, (entry.Tier + " " + entry.Rank), (entry.Wins + "//" + entry.Losses)))
                {
                    X      = Pos.Percent(0),
                    Y      = prev.Y + 1,
                    Width  = Dim.Fill(),
                    Height = 1
                };
                prev = queueType;
                SummonerInfoView.Add(queueType);
            }

            var masteriesArray = LeagueUtilities.GetTopPlayedChampions(PlayerSummoner);

            foreach (string mastery in masteriesArray)
            {
                var masteryInfo = new Label(mastery)
                {
                    X      = Pos.Percent(0),
                    Y      = prev.Y + 1,
                    Width  = Dim.Fill(),
                    Height = 1
                };
                prev = masteryInfo;
                SummonerInfoView.Add(masteryInfo);
            }
        }
示例#5
0
        private static void FilterItemList(RadioGroup.SelectedItemChangedArgs obj)
        {
            SelectedFiltering = obj.SelectedItem;

            ItemListView.SetSource(LeagueUtilities.GetItemListByTagAndName(TagsRadio.RadioLabels[obj.SelectedItem].ToString(), ItemName.Text.ToString()));
        }
示例#6
0
 private static void ItemName_TextChanged(NStack.ustring obj)
 {
     ItemListView.SetSource(LeagueUtilities.GetItemListByTagAndName(TagsRadio.RadioLabels[SelectedFiltering].ToString(), ItemName.Text.ToString()));
 }