private void FoundResults(ParseObject[] array, NSError error)
        {
            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,
            };
        }
示例#2
0
        public static ParseQuery CreateTabListQuery(ParseObject self, ParseObject p)
        {
            var query = ParseQuery.Or (new ParseQuery[] {
                new ParseQuery ("Tab")
                    .WhereEqualTo ("originator", p)
                    .WhereEqualTo ("recipient", self),
                new ParseQuery ("Tab")
                    .WhereEqualTo ("recipient", p)
                    .WhereEqualTo ("originator", self)
            });
            // Include the field we need
            query.Include ("originator");
            query.Include ("recipient");
            query.Include ("tabType");

            return query;
        }
示例#3
0
 public override void Done(ParseObject obj, ParseException error)
 {
     callback (obj, error);
 }
 public void SaveAllAsync(ParseObject [] objects, NSAction callback)
 {
     var d = new NSActionDispatcher (callback);
     SaveAllAsync (objects, d, NSActionDispatcher.Selector);
 }
 public static void FetchAllIfNeededAsync(ParseObject [] objects, NSAction callback)
 {
     var d = new NSActionDispatcher (callback);
     FetchAllIfNeededAsync (objects, d, NSActionDispatcher.Selector);
 }
示例#6
0
        public ParseObject ToParse()
        {
            if (parseObject != null)
                return parseObject;

            parseObject = new ParseObject ("Place");
            parseObject.Put ("placeName", PlaceName);
            parseObject.Put ("latLng", new ParseGeoPoint (LatLng.Item1, LatLng.Item2));
            parseObject.Put ("person", Person.ToParse ());

            return parseObject;
        }
示例#7
0
 TabPlace(ParseObject parseObject)
 {
     this.parseObject = parseObject;
 }
示例#8
0
 static TabPlace FromParse(ParseObject obj)
 {
     var geoPoint = obj.GetParseGeoPoint ("latLng");
     return new TabPlace (obj) {
         PlaceName = obj.GetString ("placeName"),
         LatLng = Tuple.Create (geoPoint.Latitude, geoPoint.Longitude),
         Person = TabPerson.FromParse (obj.GetParseObject ("person"))
     };
 }
示例#9
0
 public override void Done(ParseObject pobject, ParseException pexception)
 {
     action (pobject, pexception);
 }
示例#10
0
        public ParseObject ToParse()
        {
            if (parseData != null)
                return parseData;

            var obj = new ParseObject ("Tab");
            obj.Put ("originator", Originator.ToParse ());
            obj.Put ("recipient", Recipient.ToParse ());
            obj.Put ("direction", (int)Direction);
            obj.Put ("tabType", Type.ToParse ());
            obj.Put ("location", new ParseGeoPoint (LatLng.Item1, LatLng.Item2));
            obj.Put ("locationDesc", LocationDesc);
            obj.Put ("time", DateTimeToJavaDate (Time));
            parseData = obj;

            return obj;
        }
示例#11
0
 public static TabObject FromParse(ParseObject parseObject)
 {
     return new TabObject {
         Originator = TabPerson.FromParse (parseObject.GetParseObject ("originator")),
         Recipient = TabPerson.FromParse (parseObject.GetParseObject ("recipient")),
         Direction = (TabDirection)parseObject.GetInt ("direction"),
         Type = TabType.FromParse (parseObject.GetParseObject ("tabType")),
         LatLng = GeopointToTuple (parseObject.GetParseGeoPoint ("location")),
         LocationDesc = parseObject.GetString ("locationDesc"),
         Time = JavaDateToDateTime (parseObject.GetDate ("time")),
         parseData = parseObject
     };
 }
示例#12
0
        public static Task ExpandParseObject(ParseObject obj)
        {
            if (obj == null)
                throw new ArgumentNullException ("obj");

            var objs = new ParseObject[] {
                obj.GetParseObject ("originator"),
                obj.GetParseObject ("recipient"),
                obj.GetParseObject ("tabType"),
            };

            return Task.Factory.StartNew (() => {
                foreach (var o in objs)
                    o.FetchIfNeeded ();
            });
        }
示例#13
0
        public static ParseQuery CreateTabQuery(ParseObject self, ParseObject p, ParseObject tabType, int way)
        {
            var query = ParseQuery.Or (new ParseQuery[] {
                new ParseQuery ("Tab")
                    .WhereEqualTo ("originator", p)
                    .WhereEqualTo ("recipient", self)
                    .WhereEqualTo ("direction", way > 0 ? (int)TabDirection.Receiving : (int)TabDirection.Giving),
                new ParseQuery ("Tab")
                    .WhereEqualTo ("recipient", p)
                    .WhereEqualTo ("originator", self)
                    .WhereEqualTo ("direction", way > 0 ? (int)TabDirection.Giving : (int)TabDirection.Receiving),
            });
            query.WhereEqualTo ("tabType", tabType);

            return query;
        }
示例#14
0
 internal AndroidPerson(ParseObject obj)
 {
     this.obj = obj ?? new ParseObject ("AndroidPerson");
 }