MvvmCross vnext:合并MonoDroid的插件 [英] MvvmCross vnext: merge plugins with monodroid

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

问题描述

我试图合并的插件库项目到一个单一的一个(例如,位置+ PhoneCallTask​​)。它可以完美地配合WP7,但我得到MonoDroid的未处理的异常:

I'm trying to merge plugins library projects into a single one (for example, Location + PhoneCallTask). It works perfectly with wp7, but I get an unhandled exception with monodroid:

无法加载文件或程序集Cirrious.MvvmCross.Plugins。 Location.Droid.dll

Could not load file or assembly 'Cirrious.MvvmCross.Plugins.Location.Droid.dll'

当然,位置插件中引用Cirrious.MvvmCross.Plugins.Droid.dll',合并后的图书馆。

Of course, the location plugin is referenced in 'Cirrious.MvvmCross.Plugins.Droid.dll', the merged library.

有没有办法指向合并后的库路径?

Is there a way to point to the merged library path?

推荐答案

审议更充分您的问题...

Having considered your question more fully...

我还不能完全确定合并插件是什么,但我想这个问题你是眼看要倒到MvvmCross-MonoDroid的使用文件约定,而所有其他平台强制用户为每个插件明确的工厂方法来加载插件的方式。

I'm still not entirely sure what a merge plugin is, but I think the problem you are seeing must be down to the way that MvvmCross-MonoDroid uses file conventions to load plugins while all the other platforms force the user to provide explicit factory methods for each plugin.

之所以这样的区别是由于文件约定(IMO)这样做的最好的方式......但所有其它平台把安全性和/或编译问题在这意味着替代机制,必须使用...的方式

The reason for this difference is because the file conventions are (IMO) the nicest way of doing this... but all the other platforms put security and/or compilation issues in the way which meant that alternative mechanisms had to be used...

为你做最简单的事情可能是切换你MonoDroid的应用使用装载机约定过的设置。

The easiest thing for you to do is probably to switch the setup of your MonoDroid app to use the loader conventions too.

要做到这一点:


  • 在Setup.cs覆盖 CreatePluginManager()为:

protected override IMvxPluginManager CreatePluginManager()
{
    var toReturn = new MvxLoaderBasedPluginManager();
    var registry = new MvxLoaderPluginRegistry(".Droid", toReturn.Loaders);
    AddPluginsLoaders(registry);
    return toReturn;
}


,然后提供 AddPluginsLoaders()实施这样的:

and then provide a AddPluginsLoaders() implementation like:

    protected virtual void AddPluginsLoaders(Cirrious.MvvmCross.Platform.MvxLoaderPluginRegistry loaders)
    {
        loaders.AddConventionalPlugin<Cirrious.MvvmCross.Plugins.Visibility.Droid.Plugin>();
        loaders.AddConventionalPlugin<Cirrious.MvvmCross.Plugins.Location.Droid.Plugin>();
        loaders.AddConventionalPlugin<Cirrious.MvvmCross.Plugins.Phone.Droid.Plugin>();
        loaders.AddConventionalPlugin<AlphaPage.MvvmCross.Plugins.Mega.Droid.Plugin>();
        // etc
    }

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

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