如何从加载的图像文件而不是项目资源构建 SplashScreen
您将如何继承 System.Windows.SplashScreen 因此必须通过在精确路径加载图像时构建自身的可能性来丰富此类。
根据定义,System.Windows.SplashScreen 只提供这两个构造函数:
public SplashScreen(string resourceName);
public SplashScreen(Assembly resourceAssembly, string resourceName);
由于我仍然对 WPF 感到不自在,我不知道从哪里开始修改?
或者我应该完全重新设计我自己的 SplashScreen 类?
How would you inherit System.Windows.SplashScreen so has to enrich this class by the possibility of constructing itself on loading an image at a precise path.
By definition System.Windows.SplashScreen offers only these two constructors:
public SplashScreen(string resourceName);
public SplashScreen(Assembly resourceAssembly, string resourceName);
As I still feel ill at ease with WPF, I don't have the single idea where to start modifications ?
Or should I redesign completely my own SplashScreen class ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能无法回答您正在寻找的问题。但是如何将该图像(您有精确的路径)添加到本地资源中,并且您可以重复使用 SplashScreen 而无需重新设计
只需阅读 MSDN 文章 这里,WPF SplashScreen 似乎很差,在 WinForm 中您可以添加文本(您可以在其中显示状态消息和内容)。
might not answer you are looking for. but how about adding that image (which you have precise path) into your local resource and you can reuse SplashScreen without redesign
Just read MSDN article here, WPF SplashScreen seems to quite poor, in WinForm you could add text (where you could display status message and stuff).
为什么不为每个客户安装包含图像的资源程序集并在运行时引用或使用
Assembly.Load()
加载它?您甚至可以在工具中使用 Mono.Cecil 自动构建此类资源程序集
why not installing a resource assembly containing the image for each customer and reference or load it with
Assembly.Load()
at runtime?you can even automate the build of such a resourceassembly using Mono.Cecil in a tool
创建一个名为splashscreen 的窗口并使其成为单例,如下所示:
在 xaml 中执行您想要的所有自定义操作,例如显示状态、进度、图像等。
读取 app.config 以获取客户端详细信息并根据用户显示它。
在 void main() 的第一行或应用程序启动中调用splashscreen.showsplashscreen()。
一旦应用程序完全加载,通过同步或异步调用splashscreen.splashscreen.close()来销毁启动屏幕。
Create a window called splashscreen and make it singleton like:
Do all the customizations you want in the xaml like showing status, progress,image etc.
read app.config to get the client details and show it according to the user.
call splashscreen.showsplashscreen() in the first line of your void main() or in your appstartup.
once the application is fully loaded destroy splashscreen by calling splashscreen.splashscreen.close() either sync or async.