MVVM 模式应用程序中的消息框
我的应用程序在 UI 设计中使用 MVVM 模式。
在应用程序启动时,会出现启动屏幕并开始执行逻辑。由 IoC 容器创建的hearbeat 类实例此时会轮询插件目录以获取插件 dll。
如果该目录不存在或为空,我认为安装已损坏,需要重新安装应用程序。
此时,非常合乎逻辑(但不是非常 MVVM)的是向用户显示包含此信息的 MessageBox 并关闭应用程序。
您会推荐什么更优雅的解决方案?
我想到的一个是将 ResourceNotFound 异常冒泡到启动屏幕的 ViewModel 实例,并通过启动屏幕通知使用者。这会创造更好的用户体验吗?
My application uses MVVM pattern in UI design.
At application start-up a splash screen appears and the logic begins to execute. A hearbeat class instance, that is created by IoC container, polls the plugin directory for plugin dlls at this point.
In case the directory does not exist or is empty, I am considering that the installation is corrupted and an application need to be re-installed.
At this point very logical (but not very MVVM) would be to just show user a MessageBox with this info and close an application.
What more elegant solution would you recommend?
One that comes to my mind, is to bubble the ResourceNotFound exception to ViewModel instance of a splash screen and notify the used via splash screen. Would this create a better user experience?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会使用 IMessageBoxservice 显示错误,然后关闭应用程序。我不认为处理错误时“信息”闪屏是更好的用户体验。
i would use a IMessageBoxservice to show the error and then close the app. i dont think that the "info" splashscreen is a better user experience when handling an error.
在这种情况下,我使用属性 IsMsg 和 MsgText 创建基本视图和基本视图模型。
In such situations I create base view and base view model with properties IsMsg and MsgText.