WPF和Prism加载问题 [英] WPF and Prism loading issue

查看:289
本文介绍了WPF和Prism加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


我们在wpf应用程序和MvVM模式中实现了Prism视图。


我们注意到第一个调用视图的时间需要很长时间才能显示给用户。然后,如果我们在初始化后显示相同的视图,一旦它真的很快。


我的问题如下:


1- 那么tehre是一种加速棱镜启动过程的方法,还是设计我们必须受到棱镜启动阶段的影响?


2 - 一旦视图加载一次,是什么原因造成的再次显示第二次更快,视图是否被缓存并且所有内容都保留在内存中?


感谢您的澄清


问候


解决方案

嗨wakefun,


>&将1- 那么tehre是加速棱镜启动过程的一种方式,还是设计我们必须受到棱镜启动阶段的影响?


会有很多影响启动时间的原因,例如数据I / O,大量XAML数据绑定,UI测量等。


有一个微软博客提供指导告诉我们它上面有一些灯光:
改善WPF应用程序的启动时间


直接的方法是使用VS工具分析性能:
https://blogs.msdn.microsoft.com/wpf/2015/01/16/ new-ui-performance-analysis-tool-for-wpf-applications /


>> 2 - 视图加载一次后,什么使它再次显示得更快第二次,视图是否缓存和所有st uff是否仍在内存中?


Prism Region缓存视图,除非我们用$ b标记视图或视图模型,否则不会释放非活动视图$ b IRegionLifeTimeMember ,将 KeepAlive 设置为false。


查看Github上的源代码:
LINK


BTW,如果您对导航后端流程感兴趣,请查看
的实现
RegionManager.RequestNavigate
方法和RegionNavigationService


Dear all,

we have implement Prism view in our wpf application and MvVM pattern.

We have notice that the first time a view is called it takes a long time to be display to user. Then if we display that same view once it has been initialized once it is really fast.

My questions are as follow :

1-  Is tehre a way to speed up that launching process of prism or is it by design that we have to suffer with prism starting phase?

2 - Once a view is loaded once, what makes it display again faster teh second time, does the view is cached and all stuff remains in memory ?

thanks for clarification

regards

解决方案

Hi wakefun,

>>1-  Is tehre a way to speed up that launching process of prism or is it by design that we have to suffer with prism starting phase?

There will have lots of reasons to effect the launching time, for example, data I/O, large amounts of XAML data binding, UI measurement etc.

There is a Microsoft blog to provide a guidance to tell us some lights on it: Improving WPF applications startup time

The direct way is to analyze the performance with VS tool: https://blogs.msdn.microsoft.com/wpf/2015/01/16/new-ui-performance-analysis-tool-for-wpf-applications/

>>2 - Once a view is loaded once, what makes it display again faster teh second time, does the view is cached and all stuff remains in memory ?

The Prism Region caches the view, the inactive views won't be release unless we mark the view or view model with IRegionLifeTimeMember, setting KeepAlive as false.

Check out the source code on Github: LINK

BTW, if you are interesting in the navigation back-end process, check out the implementation of RegionManager.RequestNavigate methods and RegionNavigationService


这篇关于WPF和Prism加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆