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, }; }
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; }
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); }
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; }
TabPlace(ParseObject parseObject) { this.parseObject = parseObject; }
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")) }; }
public override void Done(ParseObject pobject, ParseException pexception) { action (pobject, pexception); }
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; }
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 }; }
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 (); }); }
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; }
internal AndroidPerson(ParseObject obj) { this.obj = obj ?? new ParseObject ("AndroidPerson"); }