1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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
- {
- /// <summary>
- /// UserLoginWindow.xaml 的交互逻辑
- /// </summary>
- 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; // 标记事件已处理
- }
- }
- }
- }
|