예제 #1
0
 private bool DoLogin(string bm, string app_pwd)
 {
     using (MD5 pwd_hash = MD5.Create())
     {
         User user = new User()
         {
             BM     = EncryptionUtil.DesEncrypt(bm),
             AppPwd = EncryptionUtil.GetMd5Hash(pwd_hash, app_pwd)
         };
         //发送至WebApi
         Task <string> response       = HttpUtil.PostAsync("http://192.168.1.117:5000/user/login", user);
         string        responseResult = response.Result;
         if (response)
         {
             Toast.MakeText(this, "用户名或密码错误", ToastLength.Short).Show();
             return(false);
         }
         //user接收并保存至全局对象
         Global.GetDictionary().Add("user", JsonConvert.DeserializeObject <User>(response));
         //启用Jpush
         //Todo
         //跳转首页到Activity
         Intent intent_home = new Intent(this, typeof(HomeActivity));
         StartActivity(intent_home);
     }
     return(true);
 }