Esempio n. 1
0
        private void LoadRank()
        {
            RankList.Clear();
            foreach (var model in SharedPreference.Instance.RankList)
            {
                RankList.Add(model);
                Title = "RANK";
            }
            var list = RankList.OrderBy(p => p.RANK_CODE);

            RankList = new ObservableCollection <RankModel>(list);
        }
Esempio n. 2
0
        private async void LoadRanks()
        {
            ObservableCollection <Tuple <int, PlayerVM> > rankList = new ObservableCollection <Tuple <int, PlayerVM> >();
            var list = new ObservableCollection <PlayerVM>();
            IEnumerable <PlayerVM> listRankIEn;

            rankList.Clear();

            string     json;
            HttpClient client = new HttpClient();

            json = await client.GetStringAsync(BASE_URL + "api/players/ranks");

            ObservableCollection <Player> players = JsonConvert.DeserializeObject <ObservableCollection <Player> >(json);

            //var tlvm = PlayerListVM.getInstance();
            //await tlvm.LoadPlayer();


            foreach (var p in players)
            {
                list.Add(new PlayerVM(p));
            }

            listRankIEn = list.OrderByDescending(m => m.Skills);

            int count = 0;

            foreach (PlayerVM p in listRankIEn)
            {
                rankList.Add(Tuple.Create(++count, p));
            }

            RankList.Clear();
            RankList = rankList;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RankList)));
        }