private void FoundResults(ParseObject[] array, NSError error)
        {
            //If there was an error or no High scores found, create an emtpy list.
            if (array == null || error != null) {
                Root = new RootElement("High Scores"){
                    new Section(){
                        new StringElement("No Scores Found"),
                    }
                };
                return;
            }
            var easySection = new Section("Easy");
            var mediumSection = new Section("Medium");
            var hardSection = new Section("Hard");

            var objects = array.Select(x=> x.ToObject<GameScore>()).OrderByDescending(x=> x.Score).ToList();

            foreach(var score in objects)
            {
                var element = new StringElement(score.Player,score.Score.ToString("#,###"));
                switch(score.Dificulty)
                {
                case GameDificulty.Easy:
                    easySection.Add(element);
                    break;
                case GameDificulty.Medium:
                    mediumSection.Add(element);
                    break;
                case GameDificulty.Hard:
                    hardSection.Add (element);
                    break;
                }
            }
            Root = new RootElement("High Scores")
            {
                easySection,
                mediumSection,
                hardSection,
            };
        }
Beispiel #2
0
 public void SaveAllAsync(ParseObject [] objects, NSAction callback)
 {
     var d = new NSActionDispatcher (callback);
     SaveAllAsync (objects, d, NSActionDispatcher.Selector);
 }
Beispiel #3
0
 public static void FetchAllIfNeededAsync(ParseObject [] objects, NSAction callback)
 {
     var d = new NSActionDispatcher (callback);
     FetchAllIfNeededAsync (objects, d, NSActionDispatcher.Selector);
 }