Showing a Splash Screen whilst initializing a WPF Prism application
来源:互联网 发布:mac版网游加速器 编辑:程序博客网 时间:2024/06/10 12:52
There are a number of ways of doing this but I thought I’d share the approach I use in one of my applications.
Now, there’s obviously going to be some delay to your app whilst Prism loads your modules, or you wouldn’t be here, and we don’t want to risk the user trying to start multiple instances of the application or wondering what’s going on – so let’s show a Splash screen.
I chose to implement the splash screen inside my Prism bootstrapper where I create the Shell. Here’s the typical code
publicoverride DependencyObject CreateShell()
{
Shell shell = new Shell();
shell.Show();
return shell;
}
And here’s what I’d change to introduce a splash screen (e.g. SplashScreen.xaml) that closes when Prism is done loading modules:
publicoverride DependencyObject CreateShell()
{
SplashScreen splash = new SplashScreen();
splash.Show();
Shell shell = new Shell();
shell.Dispatcher.BeginInvoke((Action) delegate
{
shell.Show();
splash.Close();
});
return shell;
}
This takes advantage of the fact that the Bootstrapper and ModuleLoader run on the UI thread and queues a delegate on the Dispatcher that will only get invoked when all the other stuff is done.
- Showing a Splash Screen whilst initializing a WPF Prism application
- iPhone Tutorial for Creating a Splash Screen
- Localize a WPF application
- How to do Application Initialization while showing a SplashScreen
- Create Splash Screen in WPF
- CSplashScreenEx : a non rectangular splash screen class with Alpha blending
- Android tutorial: How to make a basic splash screen
- QT28 how to display a splash screen in qt
- android wearable-Creating a 2D Picker,Showing Confirmations and Exiting Full-Screen Activities
- Initializing a Build Environment
- Initializing a Build Environment
- Initializing a Build Environment
- Initializing a Build Environment
- Initializing a Callout Driver
- Hosting Office in a WPF Application
- Splash Screen
- splash screen
- Splash screen
- 基于xmpp openfire smack开发之Android客户端开发[3]
- 基于xmpp openfire smack开发之Android消息推送技术原理分析和实践[4]
- RapidXml使用方法
- CodeForces 300C Beautiful Numbers 组合数取余
- struts2之单个文件上传
- Showing a Splash Screen whilst initializing a WPF Prism application
- Android手机上使用全局代理!
- 给电子开发工程师的建议
- BlueEyes' Schedule
- hibernate中配置<param name="sequence">SEQ_CLASS_ID</param>
- Top 10 Movies for Programmers
- 实现IAR下S19、Bin、Hex文件格式转换小技巧
- varchar和Nvarchar区别
- Try csdn blog