private void Button_Click_2(object sender, RoutedEventArgs e) { AdminWindow1 AdminWindow = new AdminWindow1(); AdminWindow.WindowStartupLocation = WindowStartupLocation.Manual; AdminWindow.Left = this.Left; AdminWindow.Top = this.Top; AdminWindow.Show(); this.Close(); }
private void btnLogin_Click(object sender, RoutedEventArgs e) { //接收用户输入数据 string name = this.txtName.Text.Trim(); string password = this.txtPassword.Password.Trim(); if (name == "" || password == "") { // 用户名密码为空 MessageBox.Show("用户名或密码不能为空!"); return; } User user = null; BookStore.BLL.UserBLL bll = new UserBLL(); bool flag = false; flag = bll.Login(name, password, out user); if (flag) { //不把密码保存在内存中 user.Password = null; //登录成功记录登录者的信息 Common.LoginUser = user; //登录成功 //MessageBox.Show("登录成功!"); AdminWindow1 AdminWindow = new AdminWindow1(); //loginWindow.Show(); AdminWindow.WindowStartupLocation = WindowStartupLocation.Manual; AdminWindow.Left = this.Left; AdminWindow.Top = this.Top; AdminWindow.Show(); this.Close(); } else { //登录失败 MessageBox.Show("用户名或密码错误!"); } /* * AdminWindow1 AdminWindow = new AdminWindow1(); * //loginWindow.Show(); * AdminWindow.WindowStartupLocation = WindowStartupLocation.Manual; * AdminWindow.Left = this.Left; * AdminWindow.Top = this.Top; * AdminWindow.Show(); * this.Close();*/ }