using CCDCount.DLL; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace CCDCountWpf { /// /// UserLoginWindow.xaml 的交互逻辑 /// public partial class UserLoginWindow : Window { public UserLoginWindow() { InitializeComponent(); } private void UserLoginBtn_Click(object sender, RoutedEventArgs e) { if(!MessageBus.UserMessageClass.CheckUserLogin(UserNameTbx.Text, UserPassTbx.Password)) { MessageBox.Show("用户名或密码错误!"); return; } MessageBus.NowLoginUserMessage = MessageBus.UserMessageClass.GetUserMessageForName(UserNameTbx.Text)[0]; FaultLog.SetUserID(MessageBus.NowLoginUserMessage.Id); SplashWindow splash = new SplashWindow(); splash.Show(); this.Close(); MainWindow mainWindow = new MainWindow(); mainWindow.Show(); splash.Close(); } private void UserCancelBtn_Click(object sender, RoutedEventArgs e) { this.Close(); Environment.Exit(0); } private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { // 触发目标按钮的点击事件 UserLoginBtn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); e.Handled = true; // 标记事件已处理 } } } }