Exemplo n.º 1
0
        ///登录事件
        private void btn_Logo_Click(object sender, System.EventArgs e)
        {
            try
            {
                string UserID   = txtName.Text;
                string Password = txtPwd.Text;
                if (UserID.Length <= 0)
                {
                    throw new Exception("用户名必须输入!");
                }
                if (Password.Length <= 0)
                {
                    throw new Exception("密码必须输入!");
                }
                //验证密码

                if (CheckBox1.Checked == true)
                {
                    //添加客户端数据
                    LoadClientData("user", UserID);

                    LoadClientData("pwd", Password);
                }
                else
                {
                    //Client .DeviceID表示设备编号
                    Client.Session["UserName"] = Client.DeviceID + "/" + UserID;
                    //删除客户端数据
                    RemoveClientData("pwd", (object s, ClientDataCallBackHandlerArgs args) =>
                    {
                        txtPwd.Text = "";
                    });
                }

                frmMune frm = new frmMune();
                this.Redirect(frm, (MobileForm sender1, object args) =>
                {
                    LblMsg.Text = "";
                }
                              );
            }
            catch (Exception ex)
            {
                LblMsg.Text      = ex.Message;
                LblMsg.Visible   = true;
                LblMsg.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 手势验证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnGestures_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(Client.Pattern.Password) == false)
     {
         //调用自动手势验证
         Client.Pattern.VerifyLocal((object s, Smobiler.Core.API.PatternLocalVerifiedEventArgs args) =>
         {
             if (args.IsError == false)
             {
                 //手势验证成功,跳转到菜单界面
                 frmMune frm = new frmMune();
                 this.Redirect(frm, (MobileForm sender1, object arg) =>
                 {
                     LblMsg.Text = "";
                 }
                               );
             }
         }
                                    );
     }
 }