コード例 #1
0
        private void EnterButton_Click(object sender, RoutedEventArgs e)
        {
            LoginResult lr = af.Login(this.number.Text, this.password.Password);

            if (lr != null)
            {
                if (lr.code == "200")
                {
                    if (AccountUtil.IsRole(AccountUtil.ADMIN, lr.data.roles))
                    {
                        CacheService.Instance.AdminToken = lr.token;
                        ConfigWindow configWindow = new ConfigWindow();
                        configWindow.Show();
                        configWindow.Owner = this.Owner;
                        this.Close();
                    }
                    else
                    {
                        LSMessageBox.Show("登录异常", "当前角色不是管理员");
                    }
                }
                else
                {
                    LSMessageBox.Show("登录错误", lr.message);
                }
            }
            else
            {
                LSMessageBox.Show("网络错误", "网络异常");
            }
        }
コード例 #2
0
 private void AdminLabel_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (CacheService.Instance.AdminToken == null)
     {
         AdminLogin adminLogin = new AdminLogin();
         adminLogin.Show();
         adminLogin.Owner = this;
         this.Hide();
     }
     else
     {
         ConfigWindow configWindow = new ConfigWindow();
         configWindow.Show();
         configWindow.Owner = this;
         this.Hide();
     }
 }