我遇到了PaymillWrapper的Xamarin.Android
问题MVVMCross
。
我安装了最新的version 3.3.0
.
并将其添加到我的App.cs
:
using MvvmCross.Platform;
using MvvmCross.Platform.IoC;
using PaymillWrapper;
namespace App.Core
{
public class App : MvvmCross.Core.ViewModels.MvxApplication
{
public override void Initialize()
{
CreatableTypes()
.EndingWith("Service")
.AsInterfaces()
.RegisterAsLazySingleton();
RegisterNavigationServiceAppStart<ViewModels.AppViewModel>();
PaymillContext paymillContext = new PaymillContext("my-private-token");
}
}
}
之后,我尝试从我的ViewModel
:
using MvvmCross.Core.ViewModels;
using MvvmCross.Platform;
using PaymillWrapper;
using PaymillWrapper.Models;
using PaymillWrapper.Service;
using System;
using System.Windows.Input;
namespace App.Core.ViewModels
{
public class AppViewModel : MvxViewModel
{
...
PaymentService paymentService = paymillContext.PaymentService;
public ICommand PayCommand => new MvxCommand(() => {
Payment payment = paymentService.CreateWithTokenAsync("my-public-token").Result;
});
我试图将初始化移动到ViewModel
:
static PaymillContext paymillContext = new PaymillContext("my-private-token");
PaymentService paymentService = paymillContext.PaymentService;
public ICommand PayCommand => new MvxCommand(() => {
Payment payment = paymentService.CreateWithTokenAsync("my-public-token").Result;
});
在这种情况下,我没有下划线,但项目没有成功构建:
Error Exception while loading assemblies: System.IO.FileNotFoundException:
Could not load assembly 'PaymillWrapper, Version=0.3.3.0, Culture=neutral, PublicKeyToken='.
Perhaps it doesn't exist in the Mono for Android profile?
File name: 'PaymillWrapper.dll'
at
Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve
(AssemblyNameReference reference, ReaderParameters parameters)
at
Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences
(DirectoryAssemblyResolver resolver, ICollection`1 assemblies,
AssemblyDefinition assembly, Boolean topLevel)
at
Xamarin.Android.Tasks.ResolveAssemblies.Execute
(DirectoryAssemblyResolver resolver) App.Droid
我在这里想念什么?
我用不同版本的MVVMCross (5.2.1, 5.6.0, 5.7.0)
.