且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果用户登录成功,那么我想显示主窗口,如果没有,我想退出应用程序

更新时间:1970-01-01 07:58:54

我想我知道我想要做什么了.

I think I figured out what I was trying to do.

1) 我需要将 App.xaml 中的StartupUri"设置为Logon.xaml",其中 Logon.xaml 是我的登录窗口.

1) I needed to set the "StartupUri" in the App.xaml to "Logon.xaml", where Logon.xaml is my logon window.

2) 在 LogonButton_Click 事件处理程序中,我添加了以下内容

2) in the LogonButton_Click event handler, I added the following

if (blnAuthenticateSuccessful) {
    MainWindow main = new MainWindow();
    App.Current.MainWindow = main;
    this.Close();
    main.Show();
}

这似乎完成了我想要的.

This seems to accomplish what I want.