using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace formula_manage { /// /// Login.xaml 的交互逻辑 /// public partial class Login : Window { public Login() { WindowStartupLocation = WindowStartupLocation.CenterScreen; InitializeComponent(); } private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { Regex re = new Regex("^[1-9]+[0-9]*$"); e.Handled = !re.IsMatch(e.Text); } private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件 { this.Close(); } private void Button_Click_1(object sender, RoutedEventArgs e) //登录按钮事件 { if ((Name.Text == "engineer" || Name.Text == "ENGINEER") && (Pasword.Password == "engineer" || Pasword.Password == "ENGINEER")) { MainWindow Main = new MainWindow(); Main.ShowDialog();//实例化并置顶打开信息窗口 this.Close(); } else { System.Windows.MessageBox.Show("账号或密码错误"); } } } }