/// <summary> /// Returns a Expedition instance /// </summary> /// <param name="parse"></param> /// <returns></returns> public static SystemPointer Map(ParseObject parseObject) { SystemPointer sp = new SystemPointer(); sp.ObjectId = parseObject.ObjectId; sp.CreatedAt = parseObject.CreatedAt.Value; sp.UpdatedAt = parseObject.UpdatedAt.Value; sp.CurrentObjectId = parseObject.Get<string>("currentObjectId"); sp.LastObjectId = parseObject.Get<string>("lastObjectId"); return sp; }
private async Task<Measurement> GetMeasurement(ParseObject parseMeasurement) { var panAngle = parseMeasurement.Get<double>("panAngle"); var tiltAngle = parseMeasurement.Get<double>("tiltAngle"); var distanceCm = parseMeasurement.Get<double>("distanceCm"); var imageParseFile = parseMeasurement.Get<ParseFile>("image"); return new Measurement(panAngle, tiltAngle, distanceCm, imageParseFile.Url.AbsoluteUri); }
private Presentation parseToPresentation (ParseObject obj) { ParseGeoPoint geoPoint = obj.Get<ParseGeoPoint> ("location"); ParseFile image = obj.Get<ParseFile> ("image"); return new Presentation ( obj.ObjectId, obj.Get<string> ("name"), obj.Get<string> ("description"), obj.Get<DateTime> ("start"), obj.Get<DateTime> ("end"), geoPoint.Latitude, geoPoint.Longitude, image.Url ); }
IEnumerator loadImage(Image imageComponent, ParseObject news) { Sprite image = template; ParseFile imageObject = news.Get<ParseFile>("image"); string path = Application.persistentDataPath + "/" + news.ObjectId + FILENAME_NEWS_PIC; bool updateExistingPic = false; if (File.Exists(path)) { updateExistingPic = DateTime.Compare(File.GetLastWriteTime(path), news.UpdatedAt.Value.AddHours(1)) < 0; } if (imageObject != null) { if ((File.Exists(path))&&!updateExistingPic) { var fileData = File.ReadAllBytes(path); var tex = new Texture2D(2, 2); tex.LoadImage(fileData); image = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); } else { var pictureRequest = new WWW(imageObject.Url.AbsoluteUri); yield return pictureRequest; byte[] fileBytes = pictureRequest.texture.EncodeToJPG(25); File.WriteAllBytes(path, fileBytes); image = Sprite.Create(pictureRequest.texture, new Rect(0, 0, pictureRequest.texture.width, pictureRequest.texture.height), new Vector2(0.5f, 0.5f)); } } imageComponent.overrideSprite = image; }
public ProductViewModel(ParseObject po) { productId = po.ObjectId; name = po.Get<string>("name"); price = po.Get<decimal>("price"); quantity = po.Get<int>("quantity"); manufacture = po.Get<string>("manufacture"); salePrice = po.Get<decimal>("salePrice"); oldPrice = po.Get<decimal>("oldPrice"); thumbnailImage = po.Get<string>("thumbnailImage"); smallSlideImage = po.Get<IList<string>>("smallSlideImage"); largeSlideImage = po.Get<IList<string>>("largeSlideImage"); }
public InterfacePage (ParseObject dataObj) { Title = "Match Data for #" + dataObj.Get<int>("matchNumber").ToString(); data = dataObj; infoLabel = new Label (); StackLayout stack = new StackLayout (); Grid masterGrid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto } }, ColumnDefinitions = { //new ColumnDefinition { Width = new GridLength(120, GridUnitType.Absolute) }, new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto } } }; Button robotShot = new Button (); robotShot.Text = "Robot Shot"; robotShot.TextColor = Color.White; robotShot.BackgroundColor = Color.Green; robotShot.WidthRequest = 120; robotShot.HeightRequest = 50; robotShot.Clicked += (object sender, EventArgs e) => { PostRobotShot(); }; masterGrid.Children.Add (robotShot, 0, 0); Button robotShot2 = new Button (); robotShot2.Text = "Robot Shot"; robotShot2.TextColor = Color.White; robotShot2.BackgroundColor = Color.Red; robotShot2.WidthRequest = 120; robotShot2.HeightRequest = 50; robotShot2.Clicked += (object sender, EventArgs e) => { PostRobotShot(); }; masterGrid.Children.Add (robotShot2, 2, 3); stack.Children.Add (infoLabel); stack.Children.Add (masterGrid); UpdateDisplay (); Content = stack; }
public ProductViewModel(ParseObject po) { productId = po.ObjectId; name = po.Get<string>("name"); price = po.Get<float>("price"); quantity = po.Get<int>("quantity"); manufacture = po.Get<string>("manufacture"); salePrice = po.Get<float>("salePrice"); oldPrice = po.Get<float>("oldPrice"); thumbnailImage = po.Get<string>("thumbnailImage"); var smallSlideImage = po.Get<IList<object>>("smallSlideImage"); this.smallSlideImage = smallSlideImage.Cast<string>(); var largeSlideImage = po.Get<IList<object>>("largeSlideImage"); this.largeSlideImage = largeSlideImage.Cast<string>(); }
/// <summary> /// Returns a Expedition instance /// </summary> /// <param name="parse"></param> /// <returns></returns> public static Expedition Map(ParseObject parseObject) { Expedition exp = new Expedition(); exp.ObjectId = parseObject.ObjectId; exp.CreatedAt = parseObject.CreatedAt.Value; exp.UpdatedAt = parseObject.UpdatedAt.Value; exp.Name = parseObject.Get<string>("name"); exp.Description = parseObject.Get<string>("description"); exp.Current = parseObject.Get<int>("current") == 1; exp.EndSystem = parseObject.Get<string>("endSystem"); exp.StartSystem = parseObject.Get<string>("startSystem"); exp.StartDate = parseObject.Get<DateTime?>("beginDate"); exp.EndDate = parseObject.Get<DateTime?>("endDate"); exp.Profit = parseObject.Get<double>("profit"); exp.TotalDistance = parseObject.Get<double>("totalDistance"); return exp; }
private void managePost(ParseObject post) { int left = -1; try { left = post.Get<int>("option1Count"); } catch (Exception e) { left = 0; } int all_votes = -1; try { all_votes = post.Get<int>("numberOfVotes"); } catch (Exception e) { all_votes = 0; } int percL = 50; if (all_votes > 0) percL = (left * 100) / all_votes; if (percL > 100) percL = 100; if (percL < 0) percL = 0; int left_voteNb = (percL * users.Count) / 100; int right_voteNb = users.Count - left_voteNb; List<ParseUser> left_voters = new List<ParseUser>(); List<ParseUser> all_users = users.ToList<ParseUser>(); System.Random r = new System.Random(); for (int i = 0; i < left_voteNb; i++) { int rnd = r.Next(all_users.Count); ParseUser user = all_users[rnd]; left_voters.Add(user); all_users.Remove(user); } StartCoroutine(vote(post, left_voters, all_users)); }
protected override void OnNavigatedTo(NavigationEventArgs e) { planitem = e.Parameter as PlanItem; plan = planitem.obj; VerNombre.Text = plan.Get<string>("nombre"); VerFecha.Text = plan.Get<string>("fecha"); VerDireccion.Text = plan.Get<string>("direccion"); VerDescripcion.Text = plan.Get<string>("descripcion"); Uri ur = plan.Get<ParseFile>("imagen").Url; BitmapImage img = new BitmapImage(ur); VerImage.Source = img; //Para lo de asistentes mostrarCreadorAsistentes(); //Configurar Mapa AddMap(); }
private void makeVote(ParseObject obj, string col, string lk, ParseUser user) { int v = 0; try { v = obj.Get<int>(col) + 1; } catch (Exception e) { v++; } int all = 0; try { v = obj.Get<int>("numberOfVotes") + 1; } catch (Exception e) { all++; } obj.Increment(col); obj.Increment("numberOfVotes"); obj.SaveAsync().ContinueWith(t => { ParseObject Like = new ParseObject("Participant"); Like.SaveAsync().ContinueWith(tt => { Like["choozy"] = obj; Like["user"] = user; Like["choice"] = lk; Like["status"] = "Voted"; Like.ACL = new ParseACL(user) { PublicReadAccess = true, PublicWriteAccess = false }; Like.SaveAsync().ContinueWith(ttt => { g.decrementVote(obj); }); }); }); }
public void LoadFromParse(ParseObject parseObj) { var thisType = this.GetType (); foreach (PropertyInfo prop in thisType.GetRuntimeProperties ()) { if (!prop.Name.Equals (Const.OBJECT_ID, StringComparison.OrdinalIgnoreCase)) { object value = null; if (parseObj.ContainsKey (prop.Name)) { value = parseObj.Get<object> (prop.Name); } prop.SetValue (this, value); } } this.objectId = parseObj.ObjectId; }
public void reset(ParseObject account) { username = account.Get<string>("username"); password = account.Get<string>("password"); LocalName = account.Get<string>("localname"); type = account.Get<string>("type"); description = account.Get<string>("description"); address = account.Get<string>("address"); Lat = account.Get<double>("lat"); Lng = account.Get<double>("lng"); replaceDictionary(account.Get<IDictionary<string, string>>("dictionary")); }
public IEnumerator LoadGameASync(int aIndex) { rankingObject = null; if(this.SavedGameExists(aIndex)) { USING_SAVE_GAME_INDEX = aIndex; GameTimer.GAME_START = true; _playerData = ES2.LoadList<string>(aIndex+DATA_NAME); new PlayerMain(); /* Note that all player data info must be given before monsters because monsters calls SavePlayerData() */ string hc = _playerData[(int) EPlayerArray.HardCurrency]; string sc = _playerData[(int) EPlayerArray.SoftCurrency]; // try { if(hc.Length>0) if(hc.StartsWith("h")) PlayerMain.REF.hardCurrency = Convert.ToInt32(hc.Substring(1)); else { PlayerMain.REF.hardCurrency = Convert.ToInt32(hc); } if(sc.Length>0) if(sc.StartsWith("s")) PlayerMain.REF.softCurrency = Convert.ToInt32(sc.Substring(1)); else { PlayerMain.REF.softCurrency = Convert.ToInt32(sc); } yield return new WaitForEndOfFrame(); string monsters1 = _playerData[(int) EPlayerArray.Monsters]; string[] monstersSplit1 = monsters1.Split(new char[] {'|'}); string[] allMonsters = PlayerMain.REF.monsterDecompressString(monstersSplit1[0]); if(monstersSplit1.Length>1) { int minuteLast = Convert.ToInt32(monstersSplit1[1]); DateTime milleniumPlus = new DateTime(2000,1,1); milleniumPlus = milleniumPlus.AddSeconds(minuteLast); int secondsSinceMillenium = Convert.ToInt32((DateTime.Now-milleniumPlus).TotalSeconds); GameTimer.REF.catchUpSeconds = secondsSinceMillenium; Debug.Log ("<color=orange>Minutes I was offline for is: "+secondsSinceMillenium+"</color>"); } for(int i = 0;i<allMonsters.Length;i++) { if(allMonsters[i].Length>0) { PlayerMain.REF.loadMonsterASync(allMonsters[i],i); this.loadingDetails = "Loading Monster: "+i; if(i%3==0) yield return new WaitForEndOfFrame(); } } PlayerMain.REF.loadRepelData(_playerData[(int) EPlayerArray.RepelBoostData]); PlayerMain.REF.loadXPBoostData(_playerData[(int) EPlayerArray.XPBoostData]); this.loadingDetails = "Loading Inventory"; yield return new WaitForEndOfFrame(); // } catch(Exception e) { // PlayerMain.REF.hardCurrency = 0; // PlayerMain.REF.softCurrency = 0; // } PlayerMain.REF.itemsFromString(_playerData[(int) EPlayerArray.Items]); PlayerMain.REF.futureDoorway = new Doorway(_playerData[(int) EPlayerArray.LastUsedMap]); // PlayerMain.REF.futureDoorway = new Doorway("Mombassi House"); string decompressedQuests = ""; yield return new WaitForEndOfFrame(); try { this.loadingDetails = "Loading Quests"; decompressedQuests = Base64Compressor.Base64Decode(_playerData[(int) EPlayerArray.Quests]); } catch(Exception e) { sendQuestData(PlayerMain.REF.name,_playerData[(int) EPlayerArray.Quests],"Decompressing"); AlertGUI.REF.DoGeneralAlert("Error on Decompressing","An error: "+e.Message+" has occurred. Your quest data has been saved. Please contact us at [email protected] for further assistance"); } yield return new WaitForEndOfFrame(); try { if(decompressedQuests.Length>0) { this.loadingDetails = "Loading Quests"; PersistentDataManager.ApplySaveData(decompressedQuests); } } catch(Exception e) { sendQuestData(PlayerMain.REF.name,_playerData[(int) EPlayerArray.Quests],"Loading"); AlertGUI.REF.DoGeneralAlert("Error on Loading","An error: "+e.Message+" has occurred. Your quest data has been saved. Please contact us at [email protected] for further assistance"); } if(_playerData[(int) EPlayerArray.Password].Length>0) { PlayerMain.REF.multiplayerName = _playerData[(int) EPlayerArray.Name]; PlayerMain.REF.multiplayerPass = _playerData[(int) EPlayerArray.Password]; ParseUser.LogInAsync(PlayerMain.REF.multiplayerName,PlayerMain.REF.multiplayerPass); DialogueLua.SetActorField("Player","Name",PlayerMain.REF.multiplayerName); // PlayerMain.REF.doMultiplayerLoginCheck(); string rankingText = _playerData[(int) EPlayerArray.RankingObjID]; if(rankingText!=null&&rankingText.Length>0) { ParseQuery<ParseObject> query = ParseObject.GetQuery("TMRank"); query.GetAsync(rankingText).ContinueWith(t => { rankingObject = t.Result; Debug.Log ("Ranking Score is: "+rankingObject.Get<int>("score")); fetchRank(); }); } else { AddToScore(0); } } else { } Application.LoadLevel("WorldViewer"); } else { Debug.LogError("Trying to Load game when no game exists: "+aIndex); } }
/// <summary> /// Convert a ParseObject to its GeoPosition counterpart /// </summary> /// <param name="p">the ParseObject instance</param> /// <returns>the GeoPosition object</returns> public static GeoPosition<GeoCoordinate> ParseObjectToGeoPosition(ParseObject p) { GeoPosition<GeoCoordinate> g = new GeoPosition<GeoCoordinate>(); g.Timestamp = new DateTimeOffset(p.Get<DateTime>(TIME_STAMP)); ParseGeoPoint pGeoPoint = p.Get<ParseGeoPoint>(LOCATION); g.Location = new GeoCoordinate(); if (pGeoPoint.Latitude != NaNforParse) g.Location.Latitude = pGeoPoint.Latitude; if (pGeoPoint.Longitude != NaNforParse) g.Location.Longitude = pGeoPoint.Longitude; Double pAltitude = p.Get<Double>(ALTITUDE); if (pAltitude != NaNforParse) g.Location.Altitude = pAltitude; Double pHAccuracy = p.Get<Double>(HORIZONTAL_ACCURACY); if (pHAccuracy != NaNforParse) g.Location.HorizontalAccuracy = pHAccuracy; Double pVAccuracy = p.Get<Double>(VERTICAL_ACCURACY); if (pVAccuracy != NaNforParse) g.Location.VerticalAccuracy = pVAccuracy; Double pSpeed = p.Get<Double>(SPEED); if (pSpeed != NaNforParse) g.Location.Speed = pSpeed; Double pCourse = p.Get<Double>(COURSE); if (pCourse != NaNforParse) g.Location.Course = pCourse; return g; }
internal AnnounceControls Initialize(ParseObject po) { greet = po.Get<bool>("greet"); greetText = po.Get<string>("greetText"); greetChannel = po.Get<ulong>("greetChannel"); bye = po.Get<bool>("bye"); byeText = po.Get<string>("byeText"); byeChannel = po.Get<ulong>("byeChannel"); this.ParseObj = po; return this; }
public static async Task<MagicListHotline> CreateHotlineFromParseObject(ParseObject parseObject) { return await Task.Run<MagicListHotline>(async () => { var mlist = new MagicListHotline(); if (parseObject.ContainsKey("languageID")) { var rel = parseObject.Get<ParseObject>("languageID"); String rel2 = rel.ObjectId; var query = from language in ParseObject.GetQuery("Language") where language.Get<string>("objectId") == rel2 select language; ParseObject obj = await query.FirstAsync(); mlist.HotlineLanguage = (string)obj["name"]; } if (parseObject.ContainsKey("email")) { mlist.HotlineEmail = (string)parseObject["email"]; } if (parseObject.ContainsKey("fax")) { mlist.HotlineFax = (string)parseObject["fax"]; } if (parseObject.ContainsKey("phone")) { mlist.HotlinePhone = (string)parseObject["phone"]; } return mlist; }); }
protected override void OnNavigatedTo(NavigationEventArgs e) { planitem = e.Parameter as PlanItem; plan = planitem.obj; editNombre.Text = plan.Get<string>("nombre"); editDescripcion.Text = plan.Get<string>("descripcion"); char[] delimeter = { '/', ' ', ':' }; string[] fechaCom = plan.Get<string>("fecha").Split(delimeter); string fec = fechaCom[1] + "/" + fechaCom[0] + "/" + fechaCom[2]; editFecha.Date = DateTime.Parse(fec); string hor = fechaCom[3]; string minute = fechaCom[4]; string am_pm = fechaCom[5]; string horaOrga = organizarHora(hor, minute, am_pm); //editFecha.Date = DateTime.Parse(fechaCom[0]); editHora.Time = TimeSpan.Parse(horaOrga); ParseFile file = plan.Get<ParseFile>("imagen"); Uri ur = file.Url; BitmapImage img = new BitmapImage(ur); editImage.Source = img; NombreLugarTxt.Text = plan.Get<string>("direccion"); gPoint = plan.Get<ParseGeoPoint>("lugar"); // Specify a known location BasicGeoposition posicion = new BasicGeoposition() { Latitude = gPoint.Latitude, Longitude = gPoint.Longitude }; Geopoint point = new Geopoint(posicion); // Set map location editMap.Center = point; editMap.ZoomLevel = 17.0f; editMap.LandmarksVisible = true; AddIcons(gPoint); }
public void TestAddUniqueToList() { ParseObject obj = new ParseObject("Corgi"); obj.AddUniqueToList("emptyList", "gogo"); obj["existingList"] = new List<string>() { "gogo" }; Assert.True(obj.ContainsKey("emptyList")); Assert.AreEqual(1, obj.Get<List<object>>("emptyList").Count); obj.AddUniqueToList("existingList", "gogo"); Assert.True(obj.ContainsKey("existingList")); Assert.AreEqual(1, obj.Get<List<object>>("existingList").Count); obj.AddUniqueToList("existingList", 1); Assert.AreEqual(2, obj.Get<List<object>>("existingList").Count); obj.AddRangeUniqueToList("newRange", new List<string>() { "anti", "anti" }); Assert.AreEqual(1, obj.Get<List<object>>("newRange").Count); }
/// <summary> /// Returns a StarSystem instance /// </summary> /// <param name="parse"></param> /// <returns></returns> public static StarSystem Map(ParseObject parse) { var starSystem = new StarSystem(); if (parse.Keys.Contains("ammoniaCount")) starSystem.AmmoniaCount = parse["ammoniaCount"] == null ? 0 : parse.Get<int>("ammoniaCount"); if (parse.Keys.Contains("blackHoleCount")) starSystem.BlackHoleCount = parse["blackHoleCount"] == null ? 0 : parse.Get<int>("blackHoleCount"); if (parse.Keys.Contains("counter")) starSystem.Counter = parse["counter"] == null ? 0 : parse.Get<int>("counter"); starSystem.CreatedAt = parse.CreatedAt.Value; if (parse.Keys.Contains("discovered")) starSystem.Discovered = parse.Get<bool>("discovered"); if (parse.Keys.Contains("distanceRT")) starSystem.DistanceRunningTotal = parse["distanceRT"] == null ? 0 : parse.Get<double>("distanceRT"); if (parse.Keys.Contains("distToNext")) starSystem.DistToNext = parse["distToNext"] == null ? 0 : parse.Get<double>("distToNext"); if (parse.Keys.Contains("earthLikeCount")) starSystem.EarthLikeCount = parse["earthLikeCount"] == null ? 0 : parse.Get<int>("earthLikeCount"); //ExpeditionId = parse.Get<string>("expedition"), if (parse.Keys.Contains("highMetalCount")) starSystem.HighMetalCount = parse["highMetalCount"] == null ? 0 : parse.Get<int>("highMetalCount"); if (parse.Keys.Contains("icyPlanetCount")) starSystem.IcyPlanetCount = parse["icyPlanetCount"] == null ? 0 : parse.Get<int>("icyPlanetCount"); if (parse.Keys.Contains("jovianCount")) starSystem.JovianCount = parse["jovianCount"] == null ? 0 : parse.Get<int>("jovianCount"); if (parse.Keys.Contains("MetalRichCount")) starSystem.MetalRichCount = parse["MetalRichCount"] == null ? 0 : parse.Get<int>("MetalRichCount"); if (parse.Keys.Contains("name")) starSystem.Name = parse.Get<string>("name"); if (parse.Keys.Contains("neutronStarCount")) starSystem.NeutronStarCount = parse["neutronStarCount"] == null ? 0 : parse.Get<int>("neutronStarCount"); if (parse.Keys.Contains("objectCount")) starSystem.ObjectCount = parse["objectCount"] == null ? 0 : parse.Get<int>("objectCount"); starSystem.ObjectId = parse.ObjectId; if (parse.Keys.Contains("refuel")) starSystem.Refuled = parse.Get<bool>("refuel"); if (parse.Keys.Contains("rockyCount")) starSystem.RockyCount = parse["rockyCount"] == null ? 0 : parse.Get<int>("rockyCount"); if (parse.Keys.Contains("scanCount")) starSystem.ScanCount = parse["scanCount"] == null ? 0 : parse.Get<int>("scanCount"); if (parse.Keys.Contains("scanCountRT")) starSystem.ScanCountRunningTotal = parse["scanCountRT"] == null ? 0 : parse.Get<double>("scanCountRT"); if (parse.Keys.Contains("starCount")) starSystem.StarCount = parse["starCount"] == null ? 0 : parse.Get<int>("starCount"); starSystem.UpdatedAt = parse.UpdatedAt.Value; if (parse.Keys.Contains("waterWorldCount")) starSystem.WaterWorldCount = parse["waterWorldCount"] == null ? 0 : parse.Get<int>("waterWorldCount"); if (parse.Keys.Contains("whiteDwarfCount")) starSystem.WhiteDwarfCount = parse["whiteDwarfCount"] == null ? 0 : parse.Get<int>("whiteDwarfCount"); if (parse.Keys.Contains("x")) starSystem.X = parse["x"] == null ? 0 : parse.Get<double>("x"); if (parse.Keys.Contains("y")) starSystem.Y = parse["y"] == null ? 0 : parse.Get<double>("y"); if (parse.Keys.Contains("z")) starSystem.Z = parse["z"] == null ? 0 : parse.Get<double>("z"); return starSystem; }
public Specification(ParseObject specification) { specificationId = specification.ObjectId; screen = specification.Get<string>("screen"); frontCamera = specification.Get<string>("frontCamera"); backCamera = specification.Get<string>("backCamera"); os = specification.Get<string>("os"); chipset = specification.Get<string>("chipset"); cpu = specification.Get<string>("cpu"); ram = specification.Get<string>("ram"); internalStorage = specification.Get<string>("internalStorage"); sdcard = specification.Get<string>("sdcard"); simNumber = specification.Get<string>("simNumber"); batery = specification.Get<string>("batery"); connection = specification.Get<string>("connection"); }
public async Task BuscaContacto (string id) { //LLAMAMOS AL METODO GetQuery DEL ParseObject, Y LE PASAMOS EL ID DEL CONTACTO A BUSCAR var query = ParseObject.GetQuery ("Contacto").WhereEqualTo("objectId", id); IEnumerable<ParseObject> results = await query.FindAsync (); //VERIFICAMOS QUE SI SE ENCONTRARON CONTACTOS if (results.ToList ().Count > 0) { //SI ES ASI, LE ASIGNAMOS LOS VALORES A LOS ELEMENTOS DE NUESTRO LAYOUT contacto = results.ToList ()[0]; txtNombre.Text=contacto.Get<string>("nombre"); txtTelefono.Text=contacto.Get<string>("telefono"); } else { Toast.MakeText (this, "No se encontro el contacto", ToastLength.Long).Show(); } }
IEnumerator Start() { cubeA.SetActive (false); cubeB.SetActive (false); cubeAInput.gameObject.SetActive (false); cubeBInput.gameObject.SetActive (false); cubeX.SetActive (false); cubeY.SetActive (false); cubeXSlider.gameObject.SetActive (false); cubeYSlider.gameObject.SetActive (false); switch (idState) { case "1": ParseQuery<ParseObject> query1 = ParseObject.GetQuery ("Version1").WhereEqualTo ("UserName", idText); var q1 = query1.FirstAsync ().ContinueWith (t => { if (t.IsCompleted) { dataLoaded = t.Result; valueA = dataLoaded.Get<float> ("A"); valueB = dataLoaded.Get<float> ("B"); } }); while (!q1.IsCompleted && !q1.IsFaulted) yield return new WaitForSeconds (1); cubeAInput.text = valueA.ToString (); cubeBInput.text = valueB.ToString (); cubeA.SetActive (true); cubeB.SetActive (true); cubeAInput.gameObject.SetActive (true); cubeBInput.gameObject.SetActive (true); cubeA.transform.localScale = new Vector3 (valueA, valueA, 1); cubeB.transform.localScale = new Vector3 (valueB, valueB, 1); break; case "2": ParseQuery<ParseObject> query2 = ParseObject.GetQuery ("Version2").WhereEqualTo ("UserName", idText); var q2 = query2.FirstAsync ().ContinueWith (t => { if (t.IsCompleted) { dataLoaded = t.Result; valueA = dataLoaded.Get<float> ("A"); valueB = dataLoaded.Get<float> ("B"); valueX = dataLoaded.Get<float> ("X"); } }); while (!q2.IsCompleted && !q2.IsFaulted) yield return new WaitForSeconds (1); cubeAInput.text = valueA.ToString (); cubeBInput.text = valueB.ToString (); cubeXSlider.value = valueX; cubeA.SetActive (true); cubeB.SetActive (true); cubeAInput.gameObject.SetActive (true); cubeBInput.gameObject.SetActive (true); cubeX.SetActive (true); cubeXSlider.gameObject.SetActive (true); cubeA.transform.localScale = new Vector3 (valueA, valueA, 1); cubeB.transform.localScale = new Vector3 (valueB, valueB, 1); cubeX.transform.localScale = new Vector3 (valueX, valueX, 1); break; case "3": ParseQuery<ParseObject> query3 = ParseObject.GetQuery ("Version3").WhereEqualTo ("UserName", idText); var q3 = query3.FirstAsync ().ContinueWith (t => { if (t.IsCompleted) { dataLoaded = t.Result; valueX = dataLoaded.Get<float> ("X"); valueY = dataLoaded.Get<float> ("Y"); } }); while (!q3.IsCompleted && !q3.IsFaulted) yield return new WaitForSeconds (1); cubeXSlider.value = valueX; cubeYSlider.value = valueY; cubeX.SetActive (true); cubeY.SetActive (true); cubeXSlider.gameObject.SetActive (true); cubeYSlider.gameObject.SetActive (true); cubeX.transform.localScale = new Vector3 (valueX, valueX, 1); cubeY.transform.localScale = new Vector3 (valueY, valueY, 1); break; } }
public bool EqualToParseObject (ParseObject o) { if (Name != o.Get<string> ("name")) return false; if (MonoExecutable != o.Get<string> ("monoExecutable")) return false; if (!OptionsEqual (MonoOptions, o ["monoOptions"] as IEnumerable<object>)) return false; if (!EnvironmentVariablesEqual (MonoEnvironmentVariables, o ["monoEnvironmentVariables"] as IDictionary<string, object>)) return false; return true; }
public void SyncData(ParseObject data) { name = data.Get<string>("name"); avatarUrl = data.Get<string>("avatarUrl"); level = data.Get<int>("level"); exp = data.Get<int>("exp"); gold = data.Get<int>("gold"); elo = data.Get<int>("elo"); gem = data.Get<int>("gem"); played = data.Get<int>("played"); win = data.Get<int>("win"); var newDragons = data.Get<IDictionary<string, object>>("dragons"); dragons.Clear(); foreach (var item in newDragons) { var dragon = new DragonPropertie((IDictionary<string, object>)item.Value); dragons.Add(item.Key, dragon); } var newItems = data.Get<IDictionary<string, object>>("items"); items.Clear(); foreach (var item in newItems) { var itemProp = new ItemPropertie((IDictionary<string, object>)item.Value); items.Add(item.Key, itemProp); } var newEmoji = data.Get<IDictionary<string, object>>("emojis"); chats.Clear(); foreach (var item in newEmoji) { chats.Add(item.Key, item.Value.ToString()); } var newFriendList = data.Get<IList<string>>("friends"); friendList.Clear(); foreach (var item in newFriendList) { friendList.Add(item.ToString()); } //Save(); }
private void createMessageObject(ParseObject message) { DateTime dateTime = new DateTime(message.Get<long>("timestamp")); string hour = (dateTime.Hour < 10) ? "0" + dateTime.Hour : "" + dateTime.Hour; string min = (dateTime.Minute < 10) ? "0" + dateTime.Minute : "" + dateTime.Minute; string sec = (dateTime.Second < 10) ? "0" + dateTime.Second : "" + dateTime.Second; string msg = message.Get<string>("message_text") + " - " + hour + ":" + min + ":" + sec; Debug.Log(msg); bool isUserMessage = message.Get<ParseUser>("sender").ObjectId.Equals(ParseUser.CurrentUser.ObjectId); GameObject messageEntryObject = isUserMessage ? chatEntryUser : chatEntryPartner; GameObject mGo = Instantiate(messageEntryObject) as GameObject; mGo.GetComponent<RectTransform>().SetParent(chatContentPanel.GetComponent<RectTransform>(),false); foreach (RectTransform item in mGo.GetComponent<RectTransform>()) { if (item.gameObject.name.Equals("Text")) { item.GetComponent<Text>().text = msg; } } }
private async Task<Measurement> GetMeasurement(ParseObject parseMeasurement) { var panAngle = parseMeasurement.Get<double>("panAngle"); var tiltAngle = parseMeasurement.Get<double>("tiltAngle"); var distanceCm = parseMeasurement.Get<double>("distanceCm"); var imageParseFile = parseMeasurement.Get<ParseFile>("image"); //var downloadTcs = new TaskCompletionSource<string>(); //Mvx.Resolve<IMvxFileDownloadCache>().RequestLocalFilePath(imageParseFile.Url.AbsoluteUri, s => //{ // var downloadPath = Path.Combine(_cacheDirPath, s); // downloadTcs.SetResult(downloadPath); // Console.WriteLine("File cached to:{0}", downloadPath); //}, exception => //{ // Console.WriteLine("Ex: " + exception); // downloadTcs.SetException(exception); //}); //var imagePath = await downloadTcs.Task; return new Measurement(panAngle, tiltAngle, distanceCm, imageParseFile.Url.AbsoluteUri); }
public async Task<IHttpActionResult> NuevaActividad([FromBody]Actividad act) { try { ParseObject actividad = new ParseObject("Actividad"); actividad["nombre"] = act.nombre; actividad["fecha"] = act.fecha; actividad["capacidad"] = act.capacidad; actividad["mensaje"] = act.mensaje; Byte[] bytes = Convert.FromBase64String(act.foto); ParseFile foto = new ParseFile("foto.png", bytes); await foto.SaveAsync(); actividad["foto"] = foto; actividad["usuario"] = await ParseUser.Query.GetAsync(act.idUsuario); actividad["Lugar"] = new ParseGeoPoint(act.lugar.lat, act.lugar.lon); await actividad.SaveAsync(); Actividad acti = new Actividad(); acti.idActividad = actividad.ObjectId; acti.idUsuario = actividad.Get<ParseUser>("usuario").ObjectId; acti.capacidad = actividad.Get<int>("capacidad"); acti.mensaje = actividad.Get<string>("mensaje"); acti.nombre = actividad.Get<string>("nombre"); acti.fecha = actividad.Get<string>("fecha"); acti.foto = actividad.Get<ParseFile>("foto").Url.AbsoluteUri; return Ok(acti); } catch (ParseException e) { return InternalServerError(e); } }
// Use this for initialization void Start() { isGlobal = true; timePassed = 0.0f; reDo = false; lastPlace = 0.0f; //print (score); thePlayerName = ""; names = new string[] {"", "", "", "", "", "", "", "", "", ""}; scores = new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; /*ParseObject newGameScore = new ParseObject("PlayerScores"); newGameScore["score0"] = 1.0f; newGameScore["score1"] = 1.0f; newGameScore["score2"] = 1.0f; newGameScore["score3"] = 1.0f; newGameScore["score4"] = 1.0f; newGameScore["score5"] = 1.0f; newGameScore["score6"] = 1.0f; newGameScore["score7"] = 1.0f; newGameScore["score8"] = 1.0f; newGameScore["score9"] = 1.0f; newGameScore["playerName0"] = "AAA"; newGameScore["playerName1"] = "AAA"; newGameScore["playerName2"] = "AAA"; newGameScore["playerName3"] = "AAA"; newGameScore["playerName4"] = "AAA"; newGameScore["playerName5"] = "AAA"; newGameScore["playerName6"] = "AAA"; newGameScore["playerName7"] = "AAA"; newGameScore["playerName8"] = "AAA"; newGameScore["playerName9"] = "AAA"; newGameScore.SaveAsync();*/ //resetLeaderboards (); objectId = "lYFGz0XjTt"; //namesScores = null; ParseQuery<ParseObject> query = ParseObject.GetQuery("PlayerScores"); query.GetAsync("lYFGz0XjTt").ContinueWith(t => { namesScores = t.Result; //Changed Code //Get the names of the top 10 players names[0] = namesScores.Get<string>("playerName0"); names[1] = namesScores.Get<string>("playerName1"); names[2] = namesScores.Get<string>("playerName2"); names[3] = namesScores.Get<string>("playerName3"); names[4] = namesScores.Get<string>("playerName4"); names[5] = namesScores.Get<string>("playerName5"); names[6] = namesScores.Get<string>("playerName6"); names[7] = namesScores.Get<string>("playerName7"); names[8] = namesScores.Get<string>("playerName8"); names[9] = namesScores.Get<string>("playerName9"); //Get the scores of the top 10 players scores[0] = namesScores.Get<float>("score0"); scores[1] = namesScores.Get<float>("score1"); scores[2] = namesScores.Get<float>("score2"); scores[3] = namesScores.Get<float>("score3"); scores[4] = namesScores.Get<float>("score4"); scores[5] = namesScores.Get<float>("score5"); scores[6] = namesScores.Get<float>("score6"); scores[7] = namesScores.Get<float>("score7"); scores[8] = namesScores.Get<float>("score8"); scores[9] = namesScores.Get<float>("score9"); lastPlace = namesScores.Get<float> ("score9"); }); changedHighScores = false; phase = 0; //print (tempFloat); }
public void TestRemoveAllFromList() { ParseObject obj = new ParseObject("Corgi"); obj["existingList"] = new List<string>() { "gogo", "Queen of Pain" }; obj.RemoveAllFromList("existingList", new List<string>() { "gogo", "missingItem" }); Assert.AreEqual(1, obj.Get<List<object>>("existingList").Count); }