ViewModel中的插件 [英] Plugins in ViewModel

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

问题描述

我是MvvmCross的新手,我想在我的Model/ViewMode中使用我的插件.我使用的是v3.

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

在某些示例中,我看到了IMvxServiceConsumer和GetService,但我想这是vNext的注释,但在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.

那我该怎么办?

谢谢

推荐答案

IMvxServiceConsumer<T>GetService<T>在v3中被替换为Mvx.Resolve<T>.

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

此外,v3提供了依赖项的构造方法注入-请参见 http://slodge.blogspot.co.uk/2013/03/v3-new-viewmodel-lifecycle.html 了解有关如何达成此决定的信息.

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.

对于插件,本教程系列中的N = 8可以快速轻松地介绍如何使用位置插件.有关更多信息,请参见:

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

这篇关于ViewModel中的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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