首页 > 解决方案 > 如何在 prism 7 中的 shell 之前显示登录屏幕?因为 app.xaml 中有 PrismApplication 而 app.xaml.cs 中没有 OnStartup() 方法

问题描述

我想在我的 prism 应用程序(prism 7)中的 shell 之前显示登录屏幕,所以我不知道该怎么做,因为 app.xaml.cs 类文件中没有 OnStartup() 方法,我在引导程序之前显示登录窗口负载。以前在 prism 5 中进行登录时,我在引导程序之前打开了一个登录窗口。如果凭据正确,则加载引导程序。请帮帮我。

// app.xaml.cs file
public partial class App
{
    protected override Window CreateShell()
    {
        return Container.Resolve<Shell>();
    }

    protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {

    }
    protected override IModuleCatalog CreateModuleCatalog()
    {
        return new ConfigurationModuleCatalog();
        //return  new DirectoryModuleCatalog() {  ModulePath = Environment.CurrentDirectory };
    }
}

标签: wpfprismprism-7

解决方案


没有 OnStartup() 方法

谁说的?

写吧

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartUp(e);
}

在您的内部app.xaml.cs并添加您需要的任何功能。


推荐阅读