我在 Bestseller 示例中找到了这个示例
public ICommand ViewDetailCommand
{
get { return new MvxRelayCommand(() => RequestNavigate<BookViewModel>(new { category= CategoryEncoded, book=ISBN })); }
}
public BookViewModel(string category = null, string book = null)
{
category = category ?? string.Empty;
book = book ?? string.Empty;
AsyncFindBook(category, book);
}
所以我试过做
public IMvxCommand GetGpsCommand
{
get
{
return new MvxRelayCommand<SetupViewModel>(type => RequestNavigate<GpsViewModel>(new {installedMeter = _installedMeter}));
}
}
public GpsViewModel(InstalledMeter installedMeter = null)
{
_installedMeter = installedMeter;
Latitude = 0.0;
Longitude = 0.0;
ButtonStartReading = "Start";
this.GetService<IGpsService>().CoordinatesFoundEvent += CoordinatesFound;
//this.GetService<IGpsService>().StartReading();
}
但是当我尝试这个时,我得到了
Cirrious.MvvmCross.Exceptions.MvxException:无法从定位器 MvxDefaultVi 加载 Core.ViewModels.InstallUnit.GpsViewModel 类型的 ViewModel…</p>