Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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());
            }
        }
Beispiel #5
0
        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();
            }
        }
Beispiel #6
0
        public void LoginTest()
        {
            Object result = Bmob.LoginTaskAsync("winse", "winse").Result;

            Console.WriteLine(BmobUser.CurrentUser);
        }