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")) { Window window = Window.GetWindow(this); MainWindow Main = new MainWindow(); window.Close(); Main.ShowDialog();//实例化并置顶打开信息窗口 } else { System.Windows.MessageBox.Show("账号或密码错误"); } } private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == Key.Enter) { SendKeys.SendWait("{Tab}"); } } } }