, Mobile ( API ).
Mobile, Back, null, ( , ):
async Task Test()
{
const int YES = 1;
const int NO = 2;
const int CANCEL = 3;
var dialog = new MessageDialog("test");
dialog.Commands.Add(new UICommand { Label = "yes", Id = YES });
dialog.Commands.Add(new UICommand { Label = "no", Id = NO });
var deviceFamily = AnalyticsInfo.VersionInfo.DeviceFamily;
if (deviceFamily.Contains("Desktop"))
{
dialog.Commands.Add(new UICommand { Label = "cancel", Id = CANCEL });
}
else if (!deviceFamily.Contains("Mobile"))
{
throw new Exception("Don't know how to show dialog for device "
+ deviceFamily);
}
var result = await dialog.ShowAsync();
var id = (int)(result?.Id ?? CANCEL);
Debug.WriteLine("You chose {0}", id);
}