Sam Debruyn

Cloud Data Solution Architect

Specialized in Microsoft Azure, Fabric & modern data stack. Microsoft Data Platform MVP. Public speaker & meetup organizer. FOSS contributor.

Sam Debruyn

Queue for MessageDialog in Windows RT

1 minutes

When I write Windows Store applications, I use MessageDialog a lot. It’s the easiest way to show a quick informative pop-up message or a question to the user. However, when you tend to use this quite often, you’ll probably run into a problem.

The Windows Runtime framework doesn’t allow you to stack MessageDialogs, queue them etc. So if you need to display one, you’ll have to make sure that no other MessageDialog is already open. Checking if there is an open MessageDialog is not that easy unless you keep references to all the MessageDialogs you create. There are a few cases in which this would be annoying.

The singleton class below will make sure that you can queue MessageDialogs and that this problem will never occur.

Instead of using

1myDialog.ShowAsync();

use

1MessageDialogQueue.PushMessageDialog(myDialog);

The dialog will be displayed after all previous MessageDialogs are closed. Do this for all your MessageDialogs or you’ll still run into the problem I mentioned.

You might also like

If you liked this article, follow me on LinkedIn, Bluesky, or other social media to stay up-to-date with my latest posts. You might also like the following 2 posts about related topics: