WPF 先显示登录成功,验证成功后显示主窗口
2021-03-31 11:24
标签:vat nlog style main out conf partial event else 代码如下: WPF 先显示登录成功,验证成功后显示主窗口 标签:vat nlog style main out conf partial event else 原文地址:https://www.cnblogs.com/qingtian224/p/9257927.html
/// 设置显示登录窗口的方法:
/// 在 App.xaml 中把这句
/// 删掉 StartupUri="MainWindow.xaml" 改为 StartupUri="Login/LoginWindow.xaml" // Login/LoginWindow.xaml是登录窗口;
/// 加上 ShutdownMode="OnLastWindowClose" public partial class LoginWindow : Window
{
public LoginWindow()
{
InitializeComponent();
}
private void btnClose_Click(object sender, RoutedEventArgs e)
{
System.Windows.Application.Current.Shutdown();
}
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
if (user_name.Text != LoginConfig.GetSettingString("UserName") ||
password.Password != LoginConfig.GetSettingString("Password"))
{
MessageBox.Show("用户名或密码错误!");
}
else
{
(new MainWindow()).Show(); // 显示主窗口;
Close();
}
}
}
文章标题:WPF 先显示登录成功,验证成功后显示主窗口
文章链接:http://soscw.com/index.php/essay/70428.html