本文整理汇总了C#中Parse.ParseObject类的典型用法代码示例。如果您正苦于以下问题:C# ParseObject类的具体用法?C# ParseObject怎么用?C# ParseObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParseObject类属于Parse命名空间,在下文中一共展示了ParseObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
//public CNj
//public BotControlScript botControllScript;
// Use this for initialization
void Start () {
//init
commandList = new ArrayList ();
this.tcpListener = new TcpListener(IPAddress.Any, serverPort);
this.listenThread = new Thread(new ThreadStart(ListenForClients));
this.listenThread.Start();
string localIP = LocalIPAddress ();
Debug.Log ("Server Start on:"+localIP);
ParseObject testObject = new ParseObject("GlassGame");
testObject["ip"] = localIP;
testObject.SaveAsync().ContinueWith(temp=>
{
var query = ParseObject.GetQuery("GlassGame").OrderByDescending("createdAt").Limit(1);
query.FirstAsync().ContinueWith(t =>
{
ParseObject obj = t.Result;
Debug.Log("Insert Parse ip:"+obj["ip"]);
Debug.Log("Parse Date:"+obj.CreatedAt);
});
});
}
示例2: Initialize
// public string description;
// public int scoreToWin;
// public bool isCollectable = false;
public void Initialize( ParseObject reward /*string name, string description*/ )
{
this.reward = reward;
labelName.text = (string)reward["name"];
labelScore.text = reward["goal"].ToString();
// this.description = description;
}
示例3: attemptSignUp
public void attemptSignUp()
{
username = nameField.GetComponent<InputField> ().text;
password = passField.GetComponent<InputField> ().text;
if (username.Equals ("")) {
setMessage("No empty usernames!");
return;
}
if (username.Length > maxUsernameLength || username.Length < minUsernameLength) {
setMessage("Names must be " + minUsernameLength + "-" + maxUsernameLength + " letters!" );
return;
}
ParseObject account = new ParseObject("Account");
account ["username"] = username;
account ["password"] = password;
account.SaveAsync ();
setMessage ("Success!");
//K so once signed in, want to let them login.
//should make signup disappear
Vector3 sscale1 = signup.GetComponent<RectTransform> ().localScale;
sscale1.x = 0;
signup.GetComponent<RectTransform> ().localScale = sscale1;
displayLogin ();
}
示例4: addScore
public static void addScore(string user_name, int score)
{
ParseObject po = new ParseObject("Leaderboard");
po["user_name"] = user_name;
po["score"] = score;
po.SaveAsync();
}
示例5: SaveEvent
public async void SaveEvent(object sender, RoutedEventArgs e)
{
try {
if(Activity.Text=="")
{
InvalidInput();
return;
}
Info data = new Info()
{
UserId = (++App.i).ToString(),
Activity = Activity.Text.Trim(),
Lat = pin.Location.Position.Latitude,
Long = pin.Location.Position.Longitude,
Interested = 1
};
var DataBase = new ParseObject("Activities");
DataBase["UserID"] = data.UserId.ToString();
DataBase["Interested"] = data.Interested;
DataBase["Activity"] = data.Activity;
DataBase["Location"] = new ParseGeoPoint(data.Lat, data.Long);
await DataBase.SaveAsync();
Frame.Navigate(typeof(Nearby));
}
catch(Exception ex)
{
Message.Text = ex.Message;
}
}
示例6: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Login);
// Create your application here
ParseClient.Initialize ("Da2XGAo55e6dqM0IayIY6WWwf4TcP9TWaWG9j3yg", "KJeICBYidEkTHOXeiR9gIC15hYm2hP04YomzJarv");
editText1 = FindViewById<EditText> (Resource.Id.editText1);
editText2 = FindViewById<EditText> (Resource.Id.editText2);
button1 = FindViewById<Button> (Resource.Id.button1);
ss = Convert.ToString(editText1.Text);
button1.Click += async delegate {
int i = 1;
string sname = string.Concat("shop", i.ToString());
ParseObject s1 = new ParseObject(sname);
s1["product_id"] = null;
s1["product_name"] = null;
s1["product_mrp"] = null;
s1["product_availability"] = null;
await s1.SaveAsync();
StartActivity(typeof(addProductsActivity));
i = i + 1;
Toast toast = Toast.MakeText(this, "Logged In", ToastLength.Long);
toast.Show();
StartActivity(typeof(addProductsActivity));
};
}
示例7: FixRunSet
static async Task FixRunSet (ParseObject runSet)
{
var runs = await ParseInterface.PageQueryWithRetry (() => {
return ParseObject.GetQuery ("Run")
.Include ("benchmark")
.WhereEqualTo ("runSet", runSet);
});
var benchmarkNames = runs.Select (r => (string) (((ParseObject)r ["benchmark"]) ["name"])).Distinct ();
Console.WriteLine ("run set {0} has {1} runs {2} benchmarks", runSet.ObjectId, runs.Count (), benchmarkNames.Count ());
var averages = new Dictionary <string, double> ();
var variances = new Dictionary <string, double> ();
foreach (var name in benchmarkNames) {
var numbers = runs.Where (r => (string)(((ParseObject)r ["benchmark"]) ["name"]) == name).Select (r => ParseInterface.NumberAsDouble (r ["elapsedMilliseconds"])).ToArray ();
var avg = numbers.Average ();
averages [name] = avg;
var sum = 0.0;
foreach (var v in numbers) {
var diff = v - avg;
sum += diff * diff;
}
var variance = sum / numbers.Length;
variances [name] = variance;
Console.WriteLine ("benchmark {0} average {1} variance {2}", name, avg, variance);
}
runSet ["elapsedTimeAverages"] = averages;
runSet ["elapsedTimeVariances"] = variances;
await runSet.SaveAsync ();
}
示例8: TestParseObjectConstructor
public void TestParseObjectConstructor() {
ParseObject obj = new ParseObject("Corgi");
Assert.AreEqual("Corgi", obj.ClassName);
Assert.Null(obj.CreatedAt);
Assert.True(obj.IsDataAvailable);
Assert.True(obj.IsDirty);
}
示例9: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.alta_contacto);
btnGuardar = FindViewById<Button> (Resource.Id.btnGuardar);
txtNombre = FindViewById<EditText> (Resource.Id.txtNombre);
txtTelefono = FindViewById<EditText> (Resource.Id.txtTelefono);
btnGuardar.Click += delegate {
ParseObject contactos = new ParseObject("MisContactos");
contactos["nombre"] =txtNombre.Text;
contactos["telefono"] = txtTelefono.Text;
contactos.SaveAsync ();
txtNombre.Text="";
txtTelefono.Text="";
Toast.MakeText (this, "Se registro nuevo contacto", ToastLength.Long).Show();
};
}
示例10: Start
// Use this for initialization
void Start()
{
ParseObject testObj = new ParseObject("TestObject");
testObj["foo"] = "bar";
Debug.Log(testObj.ToString());
testObj.SaveAsync();
}
示例11: cambiarMiInfo
private async void cambiarMiInfo(object sender, RoutedEventArgs e)
{
Esperar1.Visibility = Visibility.Visible;
try
{
var trata = new ParseObject("User");
trata.ObjectId = usu.Id;
trata["Nombre"] = nombre.Text;
trata["Apellido"] = apellido.Text;
trata["email"] = correo.Text;
trata["telefono"] = int.Parse(telefono.Text);
trata["cedula"] = cedula.Text;
trata["username"] = username.Text;
trata["password"] = password.Password;
usu.Nombre = nombre.Text;
usu.Apellido = apellido.Text;
usu.Correo = correo.Text;
usu.Telefono = uint.Parse(telefono.Text);
usu.Cedula = cedula.Text;
usu.Username = username.Text;
usu.Password = password.Password;
await trata.SaveAsync();
Esperar1.Visibility = Visibility.Collapsed;
}
catch (Exception ex)
{
Esperar1.Visibility = Visibility.Collapsed;
var dialog = new Windows.UI.Popups.MessageDialog("Tu información no ha podido ser editada");
dialog.Commands.Add(new Windows.UI.Popups.UICommand("OK") { });
var result = await dialog.ShowAsync();
}
}
示例12: ClaimCurrentScore
public void ClaimCurrentScore(string name)
{
ParseObject playerScore = new ParseObject("playerScore");
playerScore ["playerName"] = name;
playerScore ["score"] = currentTopScore;
playerScore.SaveAsync ();
}
示例13: pp
public async void pp(){
ParseObject products = new ParseObject("products");
products ["product_id"] = product_id;
products ["product_name"] = product_name;
products ["product_mrp"] = product_mrp;
await products.SaveAsync();
}
示例14: loadImage
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;
}
示例15: StoreNetworkAsync
public async Task StoreNetworkAsync(INeuralNetwork network, double eval)
{
var networkParseFormat = new ParseObject(_networkVersion);
networkParseFormat["jsonNetwork"] = JsonConvert.SerializeObject(network.GetGenes());
networkParseFormat["eval"] = eval;
await networkParseFormat.SaveAsync();
}