Xamarin.forms 适用于WindowsPhone 8.1的Xamarin Toasts插件

Xamarin.forms 适用于WindowsPhone 8.1的Xamarin Toasts插件,xamarin.forms,custom-renderer,Xamarin.forms,Custom Renderer,我需要在Xamarin.Forms上使用烤面包机。我找到了,但不是WP8.1 我在WinPhone8上遇到了很多性能问题,所以我创建了WP8.1项目 我需要做什么才能使它在WP8.1上工作?有人能帮我找出我需要做的改变吗 编辑:我在添加Toasts.Forms.Plugin包时遇到以下错误 install-package : Could not install package 'Toasts.Forms.Plugin 1.0.6.18'. You are trying to install th

我需要在Xamarin.Forms上使用烤面包机。我找到了,但不是WP8.1

我在WinPhone8上遇到了很多性能问题,所以我创建了WP8.1项目

我需要做什么才能使它在WP8.1上工作?有人能帮我找出我需要做的改变吗

编辑:我在添加
Toasts.Forms.Plugin
包时遇到以下错误

install-package : Could not install package 'Toasts.Forms.Plugin 1.0.6.18'. You are trying to install this package into a project that 
targets 'WindowsPhoneApp,Version=v8.1', but the package does not contain any assembly references or content files that are compatible with 
that framework. For more information, contact the package author.
At line:1 char:1
+ install-package Toasts.Forms.Plugin
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

如果您使用的是可移植项目,那么Toasts.Forms.Plugin实际上可用于WP8.1。我正在我的一个Xamarin表单项目WP8.1中使用它

只需使用package Manager控制台安装软件包,并确保选择WP8.1项目作为“默认项目”:

它将导致类似以下元素添加到WP8.1-project中的packages.config中

<package id="Toasts.Forms.Plugin" version="1.0.6.18" targetFramework="wp81" />
在MainPage.xaml.cs中:

ServiceRepositoryBase.Init(DependencyService.Get<IToastNotificator>());
ServiceRepositoryBase.Init(DependencyService.Get());

这是因为该插件目前只为WinPhone Silverlight(wp8)提供库。您可能在项目中使用WinRT(wpa81),插件中没有针对该目标的特定库。 要使用它,您只能将WinPhone项目更改为Silverlight 8.1项目

支持的目标可以从.nupkg文件中找到

我在添加包时出错。请参阅(更新的)问题您是否使用Silverlight 8.1项目?因为我不是;我按照Xamarin的指南添加了WP8.1项目。我的错误。正如Massimo Prota提到的,只有一个包针对Silverlight WP 8.1,这就是上面代码中使用的;我计划进行一些更改,并在其中添加WP8.1项目;因为我在WP8项目中没有看到很多代码。我已经在项目中做了很多事情,不想添加silverlight并重新检查所有内容。我根据Xamarin的指南添加了WP8.1项目。好的,Xamarin表单的WinRT支持现在是正式的,但并非所有插件都还提供WinRT库(wpa81)。这是你的案子
DependencyService.Get<IToastNotificator>()
public class ServiceRepositoryBase
{
    protected static IToastNotificator ToastNotificator;
    public static void Init(IToastNotificator toastNotificator)
    {
        ToastNotificator = toastNotificator;
    }
    // Other code here...
}
ServiceRepositoryBase.Init(DependencyService.Get<IToastNotificator>());