Ejemplo n.º 1
0
        void PopulateListView()
        {
            CouplesList = FindViewById <ListView>(Resource.Id.dancesListView);

            var scores = Repo.GetAllScores().Where(x => x.CoupleID == SelectedCoupleId);
            var dances = Repo.GetAllDances();

            var couplesDances = new List <Tuple <string, int> >();

            couplesDances.Add(new Tuple <string, int>("Average dance score", CouplesAverageScore()));

            foreach (var s in scores)
            {
                var d = dances.FirstOrDefault(x => x.DanceId == s.DanceID);
                couplesDances.Add(new Tuple <string, int>(d.Name, s.ScoreValue));
            }

            var adapter = new SimpleListItem2ListAdapter(this, couplesDances);

            CouplesList.Adapter = adapter;
        }
Ejemplo n.º 2
0
        public static void Initialise(Activity context, List <Tuple <string, int> > items, int listId, string noResultsMsg)
        {
            var listView = context.FindViewById <ListView>(listId);

            items.Sort((x, y) => y.Item2.CompareTo(x.Item2));

            for (int i = 0; i < items.Count; i++)
            {
                int rankNumber = i + 1;
                items[i] = new Tuple <string, int>("#" + rankNumber.ToString() + " " + items[i].Item1, items[i].Item2);
            }

            if (items.Count < 1)
            {
                Alert.ShowAlertWithSingleButton(context, "Error", noResultsMsg, "Ok");
            }

            var adapter = new SimpleListItem2ListAdapter(context, items);

            listView.Adapter = adapter;
        }