locked
Multiple global system dialogs cannot be displayed it seems

    Question

  • I have a HttpClient GET request and a Windows.Media.Capture.MediaCapture.initializeAsync running at approx the same time in parallel when my app starts. The first call should display a message about certificate usage (I am using system certs). The second Windows.Media.Capture.MediaCapture.initalizeAsync upon first call also wants to display a message asking the user for permission to use webcam and mic. However only thet latter dialog appears and the HTTPClient request silently runs into an error condition, since the dialog for the cert could not be displayed.

    1. Why doesn't the WinRT system properly queue global app dialogs so that the second displayed dialog waits for the first one to be confirmed by the user.

    2. Is that behaviour "by design" and if so, why?

    3. Workarounds? I think I will have to have a little helper: "PotentialGlobalDialog.run(asyncOp)" that queues up async operations that could potentially display global dialogs.

    Friday, April 24, 2015 11:49 PM

All replies

  • Dialogs are asynchronous; you'll need to wait on a promise in order to delay until the user's dealt with the input.

    The easiest thing to do is to return the promise from your call to showAsync. Change this:

    messagedialogpopup.showAsync().done(function (command) {
    

    to

    return messagedialogpopup.showAsync().then(function (command) {
       if (command) {
            if (command.id == 1) {
                console.log('proceed in popup is false');
                return false;
            }
            else if (command.id == 2) {
                console.log('proceed in popup is true');
                return true;
            }
        }
    });
    

    and change the call to doSillyMessage to:

    doSillyMessage().then(function (proceed) {
        // proceed will be true or false
    });
    

    Mark if helps

    Monday, April 27, 2015 10:18 AM
  • I was not talking about MessageDialog that I create myself. I know they cannot be displayed at the same time. I was talking about dialogs that popup from the WinRT API methods: Windows.Media.Capture.MediaCapture.initializeAsync() and HttpClient.requestAsync(). WinRT should internally queue them up, its so 90's to let the dev handle such situations. They do not use the MessageDialog API but something similar, where only one of the WinRT methods can display a dialog at the same time. If for instance Windows.Media.Capture.MediaCapture.initializeAsync() happens to display its dialog to request permission from the user to use the webcam and mic then the HTTP requestAsync call, that wants to display a confirm dialog to use the users private key, will silently fail. That is a major pain and big design fail on the WinRT API side.

    If you design a new API make it painless for the USER of that API. It should internally queue all those global dialogs (also those from MessageDialog) and when they are about to be displayed it waits for the current dialog to finish. Not so difficult to have a process wide wait queue.

    Monday, April 27, 2015 2:49 PM