In the ViewModel
, I have Save
method where I check isValid
property.
If isValid
is false
, then I want to display an error message.
Since AlertDialog
is platform specific, I wonder how do you handle that situation in the ViewModel
?
public void Save()
{
if (isValid)
{
OnExit(this, null);
}
else
{
//issue an alert dialog here
}
}
Update
I have used the following plugin and added the following line of code as follows, but it throws an error.
else
{
Mvx.Resolve<IUserInteraction>().Alert("it is not valid");
}
Update 2
Chance.MvvmCross.Plugins.UserInteraction
is a namespace but it is used as a type error.
Update 3
I have added Acr.UserDialogs plugin and called as follows, but I have got the same error.
Mvx.Resolve<IUserDialogs>().Alert("it is not valid");
Chance.MvvmCross.Plugins.UserInteraction.Droid
andChance.MvvmCross.Plugins.UserInteraction
in the Android Solution – Hyperthyroidism