开发者

How to free up resources in the new MVVMLight V4

开发者 https://www.devze.com 2023-04-09 14:54 出处:网络
I would like to know which is the best way to clean up resources in the newly fashioned ViewModelLocator for MVVM-Light V4. As far as I know, until version 3, the method ViewModelLocator.Cleanup() inv

I would like to know which is the best way to clean up resources in the newly fashioned ViewModelLocator for MVVM-Light V4. As far as I know, until version 3, the method ViewModelLocator.Cleanup() invoked the rest of the viewmodels' Cleanup() methods.

In version 4, with the new ViewModel Templates the Cleanup() methods are not included, nor th开发者_Python百科ey are generated when added to the ViewModelLocator. As I read in other similar questions related to V3, V4 was planned to centralize cleaning resources, so how can it be achieved?

Thank you.

Eddie


They are gone from the templates but are still a good standard practice (they may come back yet as V4 is still a beta)

Basically just implement the clean up method your self and ensure that it is called at the appropriate time on existing / clean-up of the app.

The clean-up function isn't called by the MVVM framework itself as it is, you have to call it manually. (shoot me if I'm wrong in that statement there :D)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号