public String login(String username, String password) { String id = ""; User user = new User(); user.username = username; user.password = password; var future = Bmob.LoginTaskAsync <User>(username, password); try { if (future.Result.identity.Equals("teacher")) { id = "登录成功" + future.Result.objectId; HttpCookie cookie = new HttpCookie("UserInfoRemember"); cookie["UserName"] = username; HttpContext.Current.Response.Cookies.Add(cookie); } else { id = "登录失败"; } } catch { id = "登录失败"; } return(id); }
public void ACLQueryTest() { Object result = Bmob.LoginTaskAsync("winse", "winse").Result; Console.WriteLine(BmobUser.CurrentUser); var query = new BmobQuery(); var future = Bmob.FindTaskAsync <GameObject>(TABLENAME, query); FinishedCallback(future.Result, null); }
public void BmobPointerTest() { var uf = Bmob.LoginTaskAsync <GameUser>("1", "2"); GameUser user = uf.Result; user.user = new UserExt(); user.user.refObjectId = "LOWbCCCK1"; var future = Bmob.UpdateTaskAsync(user); FinishedCallback(future.Result, null); }
private void loginBtn_Click(object sender, EventArgs e) { //登录用户 var future = Bmob.LoginTaskAsync <BmobUser>(username.Text, password.Text); try { FinishedCallback(future.Result, result); } catch { MessageBox.Show("登录失败,原因:" + future.Exception.InnerException.ToString()); } }
private void loginBtn_Click(object sender, EventArgs e) { //登录用户 var future = Bmob.LoginTaskAsync <BmobUser>(username.Text.Trim(), password.Text.Trim()); try { FinishedCallback(future.Result, result); if (BmobUser.CurrentUser != null) { this.Close(); } } catch { result.Text = "登录失败,原因:" + future.Exception.InnerException.ToString(); } }
public void LoginTest() { Object result = Bmob.LoginTaskAsync("winse", "winse").Result; Console.WriteLine(BmobUser.CurrentUser); }