如何在应用程序加载时检查正在加载哪些资源?
我想向用户展示我的应用程序加载时正在加载哪些资源。
示例:加载模块...
他们真的检查一些资源并加载它们吗 如果是。请帮助我编写在普通 C Sharp/wpf 应用程序中执行相同操作的代码 使用闪屏和进度条。 以及如何跟踪加载内容的进度。 一个例子可以更好地帮助我。
我正在创建一个包含 4 个模块的应用程序。 患者、医生、住院患者、内置数据。 启动屏幕后,将显示登录表单。成功登录后,将显示菜单以从 4 个模块中进行选择。
I want to show the user what resources are loading while my application is loading.
example: loading modules...
do they really check some resources and load them
if yes. please help me with the code to do the same in an normal C sharp/wpf application
using splash screen and progress bar.
also how to track the progress of loading stuffs.
an example would help me in a better way.
I am creating an application with 4 modules.
Patient, Doctor,Inpatient,Inbuilt data.
After splash screen, a log in form is shown. and after successful log in menu is shown to choose from 4 modules.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所有资源都在编译时链接。
对象是在您创建它们时在运行时创建的。
诀窍是管理您的对象创建。您应该在构造函数中执行此操作,而不是在声明部分中启动所有成员,这样您就可以对加载过程提供某种反馈。
不好的例子:
如果你这样做,对象会“自动”创建,并且你无法获得有关该过程的任何反馈(如果 A 或 B 失败,或者抛出异常,你可能会遇到致命错误......这很难进行调试)。
正确的方法应该是:
这样你就可以跟踪对象的创建过程。
之后您所要做的就是捕获消息(您可以使用事件),并将数据转发到进程栏或其他东西。
All the resources are linked at compile time.
Objects are created at run time when you create them.
The trick is to manage your object creation. Instead of initiating all the members in the declaration part, you should do that in the constructor, that way you can give some kind of feedback on the loading process.
Bad example:
if you do it that way, the object is created "automatically" and you can't get any feedback about the process (and you could have fatal errors if A or B fail, or throw an exception... it's hard to debug).
The right way should be:
This way you can keep track of the object's creation process.
All you have to do after that is just catch the messages (you can use events), and relay the data to a process bar or something.