Any asynchronous message handler which you specify for a common dialog is called twice, not once. The first call is an update/initialisation. You will generally want to ignore this, but it gives you the ID of the dialog, and makes it possible for you to destroy the dialog before the user makes a selection.
The second call to your asynchronous function is the result from the dialog. You can test for the final result callback by looking for
Framework.Ask(… , function(Msg) {
if (Msg.result) {
// Final result
} else {
// Initial creation/update
}
});
The final result,
The standard
Framework.Ask(…, function(Msg) {
if (Msg.result && Msg.result.msg == "Yes") {
// Do something if this is the final result from the dialog, and the user said "yes".
// Ignore cases - do nothing - if this message is not the final dialog result,
// or if the user clicked no or cancelled the dialog.
}
});