0

我是 wpf 和棱镜的新手。我创建了一个包含进度条的启动窗口,它的值在后台工作程序中从 0 变为 100。我不知道在哪里显示启动画面并关闭它。

我试图在解决外壳之前显示飞溅,但最终飞溅和外壳一起打开并且不知道在哪里关闭飞溅。

protected override Window CreateShell()
{
    Views.SplashScreen splashScreen = new Views.SplashScreen();
    splashScreen.Show();

    return Container.Resolve<Shell>();
}

谢谢你。

4

1 回答 1

2

正如在其他地方所写,InitializeModules是处理启动画面的好方法:

internal class App : PrismApplication
{
    // [...]
    protected override void InitializeModules()
    {
        var splashScreen = new SplashScreen( "myLogo.png" );
        splashScreen.Show( false );
        try
        {
            base.InitializeModules();
        }
        finally
        {
            splashScreen.Close( TimeSpan.Zero );
        }
    }
}
于 2019-04-11T14:56:01.210 回答