当前位置: 首页>>代码示例>>C#>>正文


C# Parse.ParseUser类代码示例

本文整理汇总了C#中Parse.ParseUser的典型用法代码示例。如果您正苦于以下问题:C# ParseUser类的具体用法?C# ParseUser怎么用?C# ParseUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParseUser类属于Parse命名空间,在下文中一共展示了ParseUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createNewUser

 public static void createNewUser(string username, string password, System.Action<bool> complete)
 {
     ParseUser user = new ParseUser (){
         Username = username,
         Password = password,
         Email = username + "@fakeEmailabc123.com"
     };
     user.SignUpAsync().ContinueWith(t => {
         if (t.IsFaulted) {
             // Errors from Parse Cloud and network interactions
             using (IEnumerator<System.Exception> enumerator = t.Exception.InnerExceptions.GetEnumerator()) {
                 if (enumerator.MoveNext()) {
                     ParseException error = (ParseException) enumerator.Current;
                     // error.Message will contain an error message
                     // error.Code will return "OtherCause"
                     Debug.Log(error.Code + " : " + error.Message);
                     complete(false);
                 }
             }
         }
         else {
             complete(true);
         }
     });
 }
开发者ID:heed13,项目名称:CS-3540-Borderlands,代码行数:25,代码来源:loginController.cs

示例2: RegUser

		//Sample Parse Function 
		public async Task RegUser (string un, string ps, string em)
		{

			ParseUser user = new ParseUser ();
			user.Username = un;
			user.Password = ps;
			user.Email = em;

			// other fields can be set just like with ParseObject
			//user ["phone"] = "415-392-0202";

			try
			{
				await user.SignUpAsync ();
				Console.WriteLine ("Account Creation Success");
				// Login was successful.
				//TODO: Open up a new page
				//await Navigation.PushModalAsync (new NEWPAGENAME () );
			}
			catch (Exception e)
			{
				// The login failed. Check the error to see why.
				Console.WriteLine("Signup error: " + e.Message);
				DisplayAlert ("Error", e.Message, "OK", "Cancel");
			}


		}
开发者ID:jonathandao0,项目名称:OfficialVitruvianApp,代码行数:29,代码来源:RegPage.cs

示例3: CreateUser

        public async Task<User> CreateUser(string username, string pass, string email)
        {
            try
            {
                var user = new ParseUser()
                {
                    Username = username,
                    Password = pass,
                    Email = email
                };

                User createdUser = new User()
                {
                    Username = user.Username
                };

                await user.SignUpAsync();

                await ParseUser.LogInAsync(username, pass);
                ((App)App.Current).AuthenticatedUser = ParseUser.CurrentUser;

                return createdUser;
            }
            catch (Exception e)
            {
                new MessageDialog(e.Message).ShowAsync();
                return null;
            }
        }
开发者ID:naturalna,项目名称:TopTen,代码行数:29,代码来源:ExternalDataService.cs

示例4: CreateUser

        public async Task<ActionResult> CreateUser(FormCollection form)
        {
            try
            {
                var user = new ParseUser()
                {
                    Username = form["username"],
                    Password = form["password"],
                    Email = form["email"]
                };

                user["firstName"] = form["firstName"].ToString();
                user["lastName"] = form["lastName"].ToString();
                user["phoneNumber"] = form["phoneNumber"].ToString();
                user["address"] = form["address"].ToString();
                user["birthday"] = DateTime.Parse(form["birthday"].ToString());
                user["gender"] = bool.Parse(form["gender"]);
                user["role"] = form["role"].ToString();

                await user.SaveAsync();
                return RedirectToAction("UserList");
            }
            catch (ParseException pe)
            {
                ViewBag.Error = "Error input form " + pe.Message + " ! Please retry";
                return View();
            }
        }
开发者ID:Ginkhust,项目名称:Mobile,代码行数:28,代码来源:UserController.cs

示例5: CreateUser

    void CreateUser()
    {
        ParseUser.LogOut();
        var user = new ParseUser(){
            Username = usuario,
            Password = pwd,
            Email = email
        };

        // other fields can be set just like with ParseObject
        user["pontuacao"] = (int) scoreInicial;

        user.SignUpAsync().ContinueWith( t => {
            if (t.IsFaulted || t.IsCanceled)
            {
                foreach (var e in t.Exception.InnerExceptions)
                {
                    ParseException parseException = (ParseException)e;
                    Debug.Log("Error message " + parseException.Message);
                    Debug.Log("Error code: " + parseException.Code);
                }
            }
            else
            {
                //SignUpAsync(); //DONE
                Debug.Log("Usuário criado com sucesso");
            }
        });

        ParseUser.LogOut();
    }
开发者ID:rbbernardino,项目名称:spyder,代码行数:31,代码来源:CriarUsuarioParse.cs

示例6: SignUp

        public async Task<IHttpActionResult> SignUp([FromBody]Usuario user)
        {
            try
            {
                ParseUser usuario = new ParseUser()
                {
                    Username = user.usuario,
                    Password = user.psw,
                    Email = user.correo
                };
                usuario["nombre"] = user.nombre;
                Byte[] bytes = Convert.FromBase64String(user.foto);
                ParseFile foto = new ParseFile("foto.png", bytes);
                await foto.SaveAsync();
                usuario["foto"] = foto;
                usuario["sexo"] = user.sexo;
                usuario["tipo"] = user.tipo;
                await usuario.SignUpAsync();

                Usuario resp = new Usuario();
                resp.usuario = user.usuario;
                resp.psw = user.psw;
                resp.correo = usuario.Get<string>("email");
                resp.foto = usuario.Get<ParseFile>("foto").Url.AbsoluteUri;
                resp.sexo = usuario.Get<string>("sexo");
                resp.tipo = usuario.Get<string>("tipo");
                resp.nombre = usuario.Get<string>("nombre");
                resp.ObjectId = usuario.ObjectId;
                return Ok(resp);
            }
            catch (ParseException e) {
                return InternalServerError(e);
            }
            
        }
开发者ID:gogodr,项目名称:Trabajo.NET,代码行数:35,代码来源:UsuarioController.cs

示例7: SignUp

    private void SignUp(string username, string password, string email, Dictionary<string, string> signUpParams)
    {
        var user = new ParseUser()
        {
            Username = username,
            Password = password,
            Email = email
        };

        foreach(var kvp in signUpParams) {
            user[kvp.Key] = kvp.Value;
        }
        user.SignUpAsync();
        /*	Task signUpTask = user.SignUpAsync();
        signUpTask.ContinueWith(
        task => {
            Debug.Log("Calling cloud function");
            ParseCloud.CallFunctionAsync<Dictionary<string,object>>("GetSuggestions", new Dictionary<string, object>()).ContinueWith(
            t => {
                var suggestions = t.Result;
                if(suggestions != null) {
                    foreach(var kvp in suggestions) {
                        Debug.Log(kvp.Key + " " + kvp.Value);
                    }
                }
            });
        });*/
    }
开发者ID:shasnat,项目名称:SportsNews,代码行数:28,代码来源:UserManager.cs

示例8: Registration

	void Registration()
	{
		Debug.LogError("Registration has been called");
		 if (usernameRegister.text == "Your full name" || emailRegister.text == "Your email" || repassRegister.text == "Enter password again" || usernameRegister.text == "" || emailRegister.text == "" || passwordRegister.text == "" || repassRegister.text == "")
		{
			message = "Please enter all the fields";
			Debug.LogError ("" +message);
		}
            else
            {
                if (passwordRegister.text == repassRegister.text)
                {
					Debug.LogError("Passwords Matched");
					var userCurrent = new ParseUser(){
						Username = usernameRegister.text,
						Email = emailRegister.text,
						Password = passwordRegister.text
					};
//					Debug.LogError ("" +userCurrent);
					Task signUpTask = userCurrent.SignUpAsync();
					message = "Sign up successful. Check your email for verification!";
                }
                else
		{
                   message = "Your Password does not match";
            }
	}
	}
开发者ID:pnmentertainment,项目名称:fireworks,代码行数:28,代码来源:NGUIParseTest.cs

示例9: TestGetSetAsync

    public Task TestGetSetAsync() {
      var storageController = new Mock<IStorageController>(MockBehavior.Strict);
      var mockedStorage = new Mock<IStorageDictionary<string, object>>();
      var controller = new ParseCurrentUserController(storageController.Object);
      var user = new ParseUser();

      storageController.Setup(s => s.LoadAsync()).Returns(Task.FromResult(mockedStorage.Object));

      return controller.SetAsync(user, CancellationToken.None).OnSuccess(_ => {
        Assert.AreEqual(user, controller.CurrentUser);

        object jsonObject = null;
        Predicate<object> predicate = o => {
          jsonObject = o;
          return true;
        };

        mockedStorage.Verify(s => s.AddAsync("CurrentUser", Match.Create<object>(predicate)));
        mockedStorage.Setup(s => s.TryGetValue("CurrentUser", out jsonObject)).Returns(true);

        return controller.GetAsync(CancellationToken.None);
      }).Unwrap()
      .OnSuccess(t => {
        Assert.AreEqual(user, controller.CurrentUser);

        controller.ClearFromMemory();
        Assert.AreNotEqual(user, controller.CurrentUser);

        return controller.GetAsync(CancellationToken.None);
      }).Unwrap()
      .OnSuccess(t => {
        Assert.AreNotSame(user, controller.CurrentUser);
        Assert.IsNotNull(controller.CurrentUser);
      });
    }
开发者ID:dragouf,项目名称:Parse-SDK-dotNET,代码行数:35,代码来源:CurrentUserControllerTests.cs

示例10: AddUser

	public virtual void AddUser(ParseDatastoreMaster pdm ){

		pdm.Dismiss ();

		var user = new ParseUser()
		{
			Username = username.text,
			Password = password.text,
			Email = email.text
		};


		user.SignUpAsync().ContinueWith (t =>
		                                 {
			if (t.IsFaulted || t.IsCanceled)
			{
				// The login failed. Check the error to see why.
				print ("signup failed!");
				print (t.Exception.Message);
				pdm.updateLoginStateFlag = true;
			}
			else
			{
				// Login was successful.
				print ("signup success");
				pdm.updateLoginStateFlag = true;
			}
		});
		
		
	}
开发者ID:shinobushiva,项目名称:Unity-Datastore.Parse,代码行数:31,代码来源:UserAddPanel.cs

示例11: TestExistsAsync

    public Task TestExistsAsync() {
      var controller = new ParseCurrentUserController();
      var user = new ParseUser();

      return controller.SetAsync(user, CancellationToken.None).OnSuccess(_ => {
        Assert.AreEqual(user, controller.CurrentUser);
        return controller.ExistsAsync(CancellationToken.None);
      }).Unwrap()
      .OnSuccess(t => {
        Assert.IsTrue(t.Result);

        controller.ClearFromMemory();

        return controller.ExistsAsync(CancellationToken.None);
      }).Unwrap()
      .OnSuccess(t => {
        Assert.IsTrue(t.Result);

        controller.ClearFromDisk();

        return controller.ExistsAsync(CancellationToken.None);
      }).Unwrap()
      .OnSuccess(t => {
        Assert.IsFalse(t.Result);
      });
    }
开发者ID:mehul9595,项目名称:Parse-SDK-dotNET,代码行数:26,代码来源:CurrentUserControllerTests.cs

示例12: Login

 private static async Task Login(string username, string password)
 {
     await Task.Delay(1000);
     await ParseUser.LogInAsync(username, password);
     await Task.Delay(1000);
     currentUser = ParseUser.CurrentUser;
 }
开发者ID:Termininja,项目名称:BGNews,代码行数:7,代码来源:Bot.cs

示例13: signup

		public async void signup(string email, string password, Action signupSuccess, Action signupError) {
			var user = new ParseUser ()
			{
				Username = email,
				Email = email,
				Password = password
			};
			try 
			{
				await user.SignUpAsync();
				Console.WriteLine("signup done");
				if (ParseUser.CurrentUser != null)
				{
					Console.WriteLine("Connected as : {0}", ParseUser.CurrentUser.Get<string>("username"));
					signupSuccess();
				}
				else
				{
					throw new Exception ("Parse Current User null");
				}
			} 
			catch (Exception e)
			{
				Console.WriteLine("Signup did not work : "+e.Message);
				signupError();
			}
		}
开发者ID:gautierdelorme,项目名称:JPOINSAXamarin,代码行数:27,代码来源:ParseManager.cs

示例14: Map

 public static User Map(ParseUser puser)
 {
     User user = new User();
     user.UserName = puser.Username;
     user.ObjectId = puser.ObjectId;
     user.Email = puser.Email;
     return user;
 }
开发者ID:jgoode,项目名称:EliteLog,代码行数:8,代码来源:UserMapper.cs

示例15: SignUp

 private void SignUp()
 {
     ParseUser userToSignUp = new ParseUser() {
         Username = CurrentUser.Username,
         Password = CurrentUser.Password
     };
     userToSignUp.SignUpAsync();
 }
开发者ID:ChuckkNorris,项目名称:ToDoDemo,代码行数:8,代码来源:LoginViewModel.cs


注:本文中的Parse.ParseUser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。