[英]How to create extended splash screen in MVVM pattern in Windows store app?
[英]Screen flashes between splash and extended splash in Windows 8 App
我正在编写Windows 8应用程序,它从互联网服务加载数据,所以我在加载过程中使用扩展的启动。 当应用程序启动时,它会显示启动画面一秒钟,然后导航到ExtendedSplash。 在飞溅之间切换时,你可以看到屏幕闪烁/闪烁几分之一秒。 我可以以某种方式避免这种闪烁吗?
基本上,在App.xaml.cs中:
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
if (_rootFrame == null)
{
_rootFrame = new Frame();
SuspensionManager.RegisterFrame(_rootFrame, "appFrame");
}
// extended splash
_rootFrame.Navigate(typeof (ExtendedSplash), args.SplashScreen);
Window.Current.Content = _rootFrame;
Window.Current.Activate();
await PerformDataFetch(); // also navigate to main page after loading complete
}
扩展的splash具有与splash +加载环相同的布局。
代替:
_rootFrame.Navigate(typeof (ExtendedSplash), args.SplashScreen);
你可能想尝试:
//The key is not how you get the new splash screen
_rootFrame.Content = new ExtendedSplash(args.SplashScreen);
//but rather in how you GET TO the Splash Screen...
// Navigation will trigger a complete refresh, reassigning a value should not.
Window.Current.Content = _rootFrame;
这样,您将避免触发刷新屏幕的导航事件。 并且Frame的内容应该无缝更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.