Alex
Alex

Reputation: 887

How to close MessageDialog programmatically in WP app?

I have a long running task in my WP app. MessageDialog must be opened before the task starts and when the task ends then MessageDialog must be automatically closed programmatically from the code. How can I achieve such behavior?

I've tried to use solution from some similar questions (first, second):

MessageDialog dialog = new MessageDialog("test");
IAsyncInfo asyncInfo = dialog.ShowAsync();

await SomeTask();

asyncInfo.Cancel();

But this didn't help me. Message dialog remains opened.

Upvotes: 1

Views: 427

Answers (1)

Alex
Alex

Reputation: 887

So I've found a solution in another question:

How to dismiss a MessageDialog from code in Windows Phone 8.1

Short answer:

  1. You can't close MessageDialog programmatically on Windows Phone.
  2. Use ContentDialog instead if you need such behavior.

Upvotes: 2

Related Questions