本文整理汇总了C#中Parse.ParseUser.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ParseUser.Add方法的具体用法?C# ParseUser.Add怎么用?C# ParseUser.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.Add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: registrar
private async void registrar(object sender, RoutedEventArgs e)
{
var user = new ParseUser()
{
Username = usern.Text,
Password = passw.Text,
};
user.Add("Name", name.Text);
user.Add("Lastname", lastname.Text);
user.Add("Ident", ident.Text);
await user.SignUpAsync();
Frame rootFrame = Window.Current.Content as Frame;
rootFrame.Navigate(typeof(LoginPage));
}
示例2: TestImmutableKeys
public void TestImmutableKeys() {
ParseUser user = new ParseUser();
string[] immutableKeys = new string[] {
"sessionToken", "isNew"
};
foreach (var key in immutableKeys) {
Assert.Throws<InvalidOperationException>(() =>
user[key] = "1234567890"
);
Assert.Throws<InvalidOperationException>(() =>
user.Add(key, "1234567890")
);
Assert.Throws<InvalidOperationException>(() =>
user.AddRangeUniqueToList(key, new string[] { "1234567890" })
);
Assert.Throws<InvalidOperationException>(() =>
user.Remove(key)
);
Assert.Throws<InvalidOperationException>(() =>
user.RemoveAllFromList(key, new string[] { "1234567890" })
);
}
// Other special keys should be good
user["username"] = "username";
user["password"] = "password";
}
示例3: Signup
public async System.Threading.Tasks.Task<bool> Signup(Models.User newUser)
{
try
{
var user = new ParseUser()
{
Email = newUser.Email,
Username = newUser.Email,
Password = newUser.Password
};
user.Add("Name", newUser.Name);
await user.SignUpAsync();
}
catch (ParseException pex)
{
UIAlertView alert;
if (pex.Code == ParseException.ErrorCode.UsernameTaken)
{
alert = new UIAlertView("Cheers", "This username is already taken", null, "Ok", null);
alert.Show();
}
else if (pex.Code == ParseException.ErrorCode.EmailTaken)
{
alert = new UIAlertView("Cheers", "This email is already taken", null, "Ok", null);
alert.Show();
}
else
{
alert = new UIAlertView("Cheers", pex.Message, null, "Ok", null);
alert.Show();
}
}
catch (InvalidOperationException inv)
{
UIAlertView alert = new UIAlertView("Cheers", inv.Message, null, "Ok", null);
alert.Show();
}
catch (Exception ex)
{
UIAlertView alert = new UIAlertView("Cheers", ex.Message, null, "Ok", null);
alert.Show();
}
return IsLoggedIn();
}
示例4: register
private async void register(object sender, RoutedEventArgs e)
{
string name_c = name.Text;
string mail = email.Text;
string fecha = Fecha_Nacimiento.Date.Day + "/" + Fecha_Nacimiento.Date.Month + "/" + Fecha_Nacimiento.Date.Year;
int s = sex.SelectedIndex;
string sexo="";
switch (s)
{
case 0:
sexo = "Hombre";
break;
case 1:
sexo = "Mujer";
break;
}
string userr = user.Text;
string passs = pass.Password;
string re_passs = re_pass.Password;
int cont_error = 0;
if (name_c.Equals("") || userr.Equals("") || passs.Equals("") || re_passs.Equals("") || mail.Equals(""))
{
Errors.Text = "Por favor llene todos los campos.";
Errors.Visibility = Visibility.Visible;
var margin = panel.Margin;
margin.Top = -17;
panel.Margin = margin;
cont_error = 1;
}
if (!passs.Equals(re_passs))
{
Errors.Text = "Las contraseñas deben conicidir.";
Errors.Visibility = Visibility.Visible;
var margin = panel.Margin;
margin.Top = -17;
panel.Margin = margin;
cont_error = 1;
}
if (cont_error == 0)
{
try
{
PrgRing.Visibility = Visibility.Visible;
panel.Visibility = Visibility.Collapsed;
if (photo == null)
{
var packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assetsFolder = await packageLocation.GetFolderAsync("Assets");
if (sexo.Equals("Mujer")){
photo = await assetsFolder.GetFileAsync("mujer.jpg");
}
else {
photo = await assetsFolder.GetFileAsync("hombre.jpg");
}
}
var bytes = await GetBtyeFromFile(photo);
ParseFile parseFile = new ParseFile(userr + ".jpg", bytes, "image/jpeg");
ParseUser user = new ParseUser()
{
Username = userr,
Password = passs,
Email = mail
};
// other fields can be set just like with ParseObject
user["name"] = name_c;
user["sex"] = sexo;
user["b_date"] = fecha;
user.Add("photo", null);
await user.SignUpAsync();
PrgRing.Visibility = Visibility.Collapsed;
user["photo"] = parseFile;
await user.SaveAsync();
await ParseUser.LogInAsync(userr, passs);
Accept.Visibility = Visibility.Visible;
await Task.Delay(2000);
Frame rootFrame = Window.Current.Content as Frame;
rootFrame.Navigate(typeof(MainPage));
}
catch (Exception ex)
{
PrgRing.Visibility = Visibility.Collapsed;
panel.Visibility = Visibility.Visible;
string error = ex.Message;
if (error.Contains("username"))
{
Errors.Text = "El usuario "+userr+" ya se encuentra registrado.";
Errors.Visibility = Visibility.Visible;
var margin = panel.Margin;
margin.Top = -17;
panel.Margin = margin;
//.........这里部分代码省略.........
示例5: Signup
public async System.Threading.Tasks.Task<bool> Signup(Models.User newUser)
{
try
{
var user = new ParseUser()
{
Email = newUser.Email,
Username = newUser.Email,
Password = newUser.Password
};
user.Add("Name", newUser.Name);
await user.SignUpAsync();
}
catch (ParseException pex)
{
Console.WriteLine(pex.Message);
}
catch (InvalidOperationException inv)
{
Console.WriteLine(inv.Message);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return IsLoggedIn();
}
示例6: CadastrarUsuario
IEnumerator CadastrarUsuario()
{
_4Label.text = "Cadastrando Usuario...";
_4btvoltar.gameObject.SetActive (false);
if(ParseUser.CurrentUser != null)
ParseUser.LogOut();
bool cadastrando = true;
string warningString = "";
ParseUser newUser = new ParseUser (){Username = _2NickEscolhido, Password = _2NickEscolhido};
newUser.Add ("nome", _2OldString);
newUser.SignUpAsync ().ContinueWith(task=> {
if(task.IsFaulted)
{
print ("t is faulted");
// warningString = "Falha ao Cadastrar.";
//
// print(task.Exception.Message);
// foreach(var ex in task.Exception.InnerExceptions){
// print(ex.Message);
// }
//print(pex.HelpLink);
}
else if(task.IsCanceled)
{
print("t is canceled");
}
else
{
warningString = "Usuario cadastrado\ncom sucesso!";
}
cadastrando = false;
});
while(cadastrando)
yield return null;
_4Label.text = warningString;
nickInputLogin.value = _2NickEscolhido;
_4btvoltar.gameObject.SetActive(true);
}