Plugins in ViewModel

丶灬走出姿态 提交于 2019-12-25 00:39:28

问题


I'm new on MvvmCross and I want to use my plugin in my Model/ViewMode. I use the v3.

In some example I see IMvxServiceConsumer and GetService, but I guess that is the annotation for vNext but it seems to be different in the v3.

So, how can I do that?

Thanks


回答1:


IMvxServiceConsumer<T> and GetService<T> were replaced with Mvx.Resolve<T> in v3.

Further, v3 provides constructor injection of dependencies - see http://slodge.blogspot.co.uk/2013/03/v3-new-viewmodel-lifecycle.html for information about how this decision was reached.

For plugins, N=8 in the tutorial series gives a quick and easy introduction to using the Location plugin. For more info see:

  • blog - http://slodge.blogspot.co.uk/2013/05/n8-location-location-location-n1-days.html
  • youtube - https://www.youtube.com/watch?v=AomjbED9AzM&list=PLR6WI6W1JdeYSXLbm58jwAKYT7RQR31-W&index=10

If you want to write a new plugin, then :

  • the up-to-date sample is https://github.com/slodge/MvvmCross-Tutorials/tree/master/GoodVibrations
  • there are some notes on this sample in https://speakerdeck.com/cirrious/plugins-in-mvvmcross


来源:https://stackoverflow.com/questions/16773900/plugins-in-viewmodel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!