我用Prism 6创建了WPF C#项目,
和我的项目基于
https://github.com/PrismLibrary/Prism-Samples-Wpf/tree/master/17-BasicRegionNavigation
我想添加身份验证 :),只需简单登录和退出 ...
我有MainWindow
和LoginView
(两个Windows都有)
我的Bootstraper.cs
class Bootstrapper : UnityBootstrapper
{
protected override DependencyObject CreateShell()
{
//return Container.Resolve<MainWindow>();
return Container.Resolve<LoginWindow>();
}
protected override void InitializeShell()
{
Application.Current.MainWindow.Show();
}
protected override void ConfigureModuleCatalog()
{
var catalog = (ModuleCatalog)ModuleCatalog;
catalog.AddModule(typeof(ModuleInitializer));
}
}
和我的LoginView
登录按钮:
如果还有另一种方法来处理MVVM中的身份验证?
private void Login_Button_Click(object sender, RoutedEventArgs e)
{
Application.Current.MainWindow.Show();
this.Close();
}
答案 0 :(得分:1)