I have a MessageDialog with just a single button in my App.xaml.cs I wish to use it from other pages. Several approaches seem to work but as there are subtleties with async and Tasks is a particular one correct?
The following is called with await App.mymessagebox("A message")
:
public static Task async mymessagebox(string the_message)
{
MessageDialog messagedialog=new MessageDialog(the_message);
await messagedialog.ShowAsync();
}
The following is called with App the_app=(App)Application.current;
await the_app.mymessagebox("A message");
:
public async Task mymessagebox(string the_message)
{
MessageDialog messagedialog=new MessageDialog(the_message);
await messagedialog.ShowAsync();
}