示例#1
0
		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();

			};



		}
示例#2
0
 // Use this for initialization
 void Start()
 {
     ParseObject testObj = new ParseObject("TestObject");
     testObj["foo"] = "bar";
     Debug.Log(testObj.ToString());
     testObj.SaveAsync();
 }
示例#3
0
        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;
            }


        }
示例#4
0
    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 ();
    }
        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));
            };
        }
	//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);
			});
			
		});
		
		
		
		
		
		
		
	}
	void SaveHighScore(string score)
	{
		ParseObject gameScore = new ParseObject("GameScore");
		gameScore["score"] = score;
		gameScore["playerName"] = ParseUser.CurrentUser.Username;
		gameScore.SaveAsync();
	}
示例#8
0
        public async void UploadtoParse()
        {

            ParseClient.Initialize("oVFGM355Btjc1oETUvhz7AjvNbVJZXFD523abVig", "4FpFCQyO7YVmo2kMgrlymgDsshAvTnGAtQcy9NHl");

            var filePicker = new FileOpenPicker();
            filePicker.FileTypeFilter.Add(".png");
            var pickedfile = await filePicker.PickSingleFileAsync();
            using (var randomStream = (await pickedfile.OpenReadAsync()))
            {
                using (var stream = randomStream.AsStream())
                {
                    //byte[] data = System.Text.Encoding.UTF8.GetBytes("Working at Parse is great!");
                    ParseFile file = new ParseFile("resume1.png", stream);

                    await file.SaveAsync();

                    var jobApplication = new ParseObject("JobApplication");
                    jobApplication["applicantName"] = "jambor";
                    jobApplication["applicantResumeFile"] = file;
                    await jobApplication.SaveAsync();

                }
            }

          

        }
 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();
 }
示例#10
0
		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 ();
		}
 public void ClaimCurrentScore(string name)
 {
     ParseObject playerScore = new ParseObject("playerScore");
     playerScore ["playerName"] = name;
     playerScore ["score"] = currentTopScore;
     playerScore.SaveAsync ();
 }
        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();
            }
        }
示例#13
0
 protected async void SaveAsync()
 {
     ParseObject gameScore = new ParseObject("GameScore");
     gameScore["score"] = 1337;
     gameScore["playerName"] = "Sean Plott";
     await gameScore.SaveAsync();                    
 }
		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();
		}
        public void Cadastrar()
        {
            DateTime? _datetime = time_abre.Value;
            string hr_abre = _datetime.Value.Hour + ":" + _datetime.Value.Minute;

            _datetime = time_fecha.Value;
            string hr_fecha = _datetime.Value.Hour + ":" + _datetime.Value.Minute;

            ListPickerItem selectedItem = (ListPickerItem)lst_segmento.SelectedItem;
            string segmento_lst = (string)selectedItem.Content;

            if((txt_foodtruck_nome.Text != "")||(segmento_lst != "")||(hr_abre != "")||(hr_fecha != "")||(txt_preco.Text != "")||(txt_telefone.Text != ""))
            {
                ParseObject cadastro = new ParseObject("Foodtruck");
                cadastro["idUser"] = Id;
                cadastro["Foodtruck_nome"] = txt_foodtruck_nome.Text;
                cadastro["Segmento"] = segmento_lst;
                cadastro["Hr_Abre"] = hr_abre;
                cadastro["Hr_Fecha"] = hr_fecha;
                cadastro["Preco"] = txt_preco.Text;
                cadastro["Telefone"] = txt_telefone.Text;
                cadastro["latitude"] = "0.0";
                cadastro["longitude"] = "0.0";
                cadastro.SaveAsync();

                MessageBoxResult cadastro_ok = MessageBox.Show("Dados cadastrado com sucesso!", "FoodTruck Show", MessageBoxButton.OK);
                if (cadastro_ok == MessageBoxResult.OK)
                    NavigationService.GoBack();
            }
            else
            {
                MessageBoxResult msn_erro = MessageBox.Show("Todos os campos devem ser preenchidos obrigatoriamente.", "Preencha todos os dados!", MessageBoxButton.OK);
            }
        }
示例#16
0
	public static void SendScore(int score)
	{
		
		ParseObject testObject = new ParseObject("Score");
		testObject["foo"] = "bar";
		testObject.SaveAsync();
	}
示例#17
0
 public static void addScore(string user_name, int score)
 {
     ParseObject po = new ParseObject("Leaderboard");
     po["user_name"] = user_name;
     po["score"] = score;
     po.SaveAsync();
 }
示例#18
0
    public IEnumerator Test()
    {
        int number = 43;
        string str = "the number is " + number;
        DateTime date = DateTime.Now;
        IList<object> list = new List<object> { str, number };
        IDictionary<string, object> dictionary = new Dictionary<string, object>
        {
            { "number", number },
            { "string", str }
        };

        var bigObject = new ParseObject("BigObject");
        bigObject["myNumber"] = number;
        bigObject["myString"] = str;
        bigObject["myDate"] = date;
        bigObject["myList"] = list;
        bigObject["myDictionary"] = dictionary;
        Task task = bigObject.SaveAsync();

        while(!task.IsCompleted) { Debug.Log("Saving"); yield return null; }

        {
            if(task.IsFaulted || task.IsCanceled)
            {
                Debug.Log("Failed: " + task.Exception.ToString());
            }
            else
            {
                Debug.Log("Succeeded");
            }
        }

        Debug.Log("Saved");
    }
示例#19
0
 public async void ParseTest()
 {
     ParseClient.Initialize("oVFGM355Btjc1oETUvhz7AjvNbVJZXFD523abVig", "4FpFCQyO7YVmo2kMgrlymgDsshAvTnGAtQcy9NHl");
     ParseObject gameScore = new ParseObject("GameScore");
     gameScore["score"] = 1337;
     gameScore["playerName"] = "Sean Plott";
     await gameScore.SaveAsync();
 }
示例#20
0
 public Task CreateAsync(MockService mockResponse)
 {
     var dbMockResponse = new ParseObject("MockService");
     dbMockResponse["key"] = mockResponse.Key;
     dbMockResponse["body"] = mockResponse.Body;
     dbMockResponse["name"] = mockResponse.Name;
     return dbMockResponse.SaveAsync();
 }
示例#21
0
    // Use this for initialization
    void Start()
    {
        mytext = gameObject.GetComponent<TextMesh> ();

        ParseObject testObject = new ParseObject ("TestObject");
        testObject ["food"] = "bar";
        testObject.SaveAsync ();
    }
 public static void SaveScore(int score)
 {
     ParseObject gameScore = new ParseObject("Score");
     gameScore["Score"] = score;
     gameScore.SaveAsync ().ContinueWith (t => {
         Debug.Log(gameScore.ObjectId);
     });
 }
 private async void btnCrear_Click(object sender, RoutedEventArgs e)
 {
     ParseObject nota = new ParseObject("Nota");
     nota["titulo"] = this.txtTitulo.Text;
     nota["nota"] = this.getNota();
     await nota.SaveAsync();
     this.refrescar();
     this.limpiarCampos();
 }
示例#24
0
 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     ParseObject Employee = new ParseObject("Employee");
     Employee["EName"] = Emp_Name.Text;
     Employee["Eid"] = int.Parse(Emp_Id.Text);
     Employee["Designation"] = Desig.Text;
     Employee["Manager"] = Emp_Mgr.Text;
     await Employee.SaveAsync();
 }
示例#25
0
    public void AddBattleRecord(string serverID,string serverName,float serverOffset,string clientID,string clientName,float clientOffset)
    {
        Debug.Log ("Try To Add Battle Record");
                Debug.Log ("Writing Battle");

                ParseObject battle = new ParseObject("Battle");
                battle ["serverID"] = serverID;
                battle ["serverName"] = serverName;
                battle ["serverOffset"] = serverOffset;
                battle ["clientID"] = clientID;
                battle ["clientName"] = clientName;
                battle ["clientOffset"] = clientOffset;

                string winnerID = "?";
                if (serverOffset > clientOffset)
                {
                    if (clientOffset < 0)
                    {
                        //you win
                        winnerID = serverID;

                    }
                    else
                    {
                        //you lose
                        winnerID = clientID;
                    }
                }
                else
                {
                    if (serverOffset < 0)
                    {
                        //you lose
                        winnerID = clientID;
                    }
                    else
                    {
                        //you win
                        winnerID = serverID;
                    }
                }

                battle ["winnerID"] = winnerID;

                battle.SaveAsync().ContinueWith((Task t)=>
                {
                    if (t.IsFaulted || t.IsCanceled)
                    {
                        Debug.Log ("Failed:" + t.Exception);
                    }
                    else
                    {
                        Debug.Log("Add Battle Success");
                    }

                });
    }
示例#26
0
 private void SendMessage()
 {
     var chatMessage = new ParseObject("ChatMessage");
     chatMessage["color"] = MY_COLOR;
     chatMessage["message"] = Message.Text;
     chatMessage["user"] = MY_USER;
     chatMessage["to"] = ((TextBlock)ToListPicker.SelectedItem).Text;
     chatMessage.SaveAsync();
 }
示例#27
0
 // Use this for initialization
 void Start()
 {
     //Basic save data
     ParseObject gameScore = new ParseObject ("GameScore");
     gameScore ["playerName"] = "Natachanan  Lumpikanon";
     gameScore ["score"] = 2300;
     gameScore ["cheatMode"] = true;
     gameScore.SaveAsync ();
 }
示例#28
0
        public async Task<string> SaveAs(string ListName)
        {
            var SpellingWordList = new ParseObject("SpellingWordList");
            SpellingWordList["ListName"] = ListName; 
            SpellingWordList["SpellingWords"] = this.SpellingWords; 
            SpellingWordList["UsageSentances"] = this.UsageSentances; 

            await SpellingWordList.SaveAsync();
            return ListName + " -- Save As Complete";
        }
示例#29
0
文件: ParseApi.cs 项目: QuenZhan/EWP
 public void hisLogin()
 {
     var poHis=new ParseObject("History");
     var user=ParseUser.CurrentUser;
     poHis["user"]=user;
     poHis["dscription"]="continue game";
     poHis["machineName"]=System.Environment.MachineName;
     poHis["ip"]=getIp();
     poHis.SaveAsync();
 }
示例#30
0
        public async Task<ActionResult> AddNews(News fc)
        {
            ParseObject newsObj = new ParseObject("News");
            newsObj["title"] = fc.title;
            newsObj["content"] = fc.content;

            await newsObj.SaveAsync();

            return RedirectToAction("ShowNews");
        }