私は最近、MVVM Lightの作業を開始し、IDialogServiceを初めて使用しました。Xamarin.Forms MVVM Light IDialogService ShowMessageネイティブ例外をスローする
この例外を発生させているawait _dialogService.ShowMessage("test", "test", "Ok", "Nop", (result) => {
if (result)
{
//...
}
else
{
//...
}
});
:
Java.Lang.NullPointerException: Attempt to invoke virtual method
'android.content.res.Resources$Theme android.content.Context.getTheme()'
on a null object reference
ShowMessageを使用して
マイViewModelLocator
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
// Register the dialog service provided by mvvm light
SimpleIoc.Default.Register<IDialogService, DialogService>();
私のViewModel
private IRestService _restService;
public OrderViewModel (IDialogService dialogService)
{
_dialogService = dialogService;
}
そして最後に
誰かが私に何が起こっているか教えてもらえますか?
は、あなたの活動がMVVM光の 'ActivityBase'から継承んそれを登録することができますか? –
どのアクティビティでですか? – FriedSloth
私の答えを参照してください –