使用 mvvmcross + xamarin 形式的 UWP 错误
Error UWP with mvvmcross + xamarin forms
我正在尝试导航到 xamarin 表单中的另一个视图 + mvvmcross
public ICommand GoCommand
{
get
{
return new MvxCommand(() => ShowViewModel<SecondViewModel>());
}
}
Android 工作正常,但 UWP 在 Show 方法中崩溃("Error HRESULT E_FAIL has been returned from a call to a COM component"):
public async void Show(MvxViewModelRequest request)
{
if (await this.TryShowPage(request))
{
return;
}
Mvx.Error("Skipping request for {0}", request.ViewModelType.Name);
}
有什么想法吗??提前致谢!
太棒了!!,我已经看到了我的错误。我需要添加此代码
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
方法结果:
public MainPage()
{
this.InitializeComponent();
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
MvxFormsWindowsUniversalViewPresenter presenter = Mvx.Resolve<IMvxViewPresenter>() as MvxFormsWindowsUniversalViewPresenter;
if (presenter == null)
{
return;
}
this.LoadApplication(presenter.XamarinFormsApp);
}
我正在尝试导航到 xamarin 表单中的另一个视图 + mvvmcross
public ICommand GoCommand
{
get
{
return new MvxCommand(() => ShowViewModel<SecondViewModel>());
}
}
Android 工作正常,但 UWP 在 Show 方法中崩溃("Error HRESULT E_FAIL has been returned from a call to a COM component"):
public async void Show(MvxViewModelRequest request)
{
if (await this.TryShowPage(request))
{
return;
}
Mvx.Error("Skipping request for {0}", request.ViewModelType.Name);
}
有什么想法吗??提前致谢!
太棒了!!,我已经看到了我的错误。我需要添加此代码
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
方法结果:
public MainPage()
{
this.InitializeComponent();
var start = Mvx.Resolve<IMvxAppStart>();
start.Start();
MvxFormsWindowsUniversalViewPresenter presenter = Mvx.Resolve<IMvxViewPresenter>() as MvxFormsWindowsUniversalViewPresenter;
if (presenter == null)
{
return;
}
this.LoadApplication(presenter.XamarinFormsApp);
}