我针对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
但我可以看到以下错误: PaymillWrapper
我尝试将初始化移至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)
我在这里缺少什么?
我使用不同版本的NOP_VIEWER.model.getUnitScale()
尝试了此解决方案。