Is there a way to show modal dialogs using edge extension with native messaging module?
Background
I'm working on a enterprise Edge extension that should monitor user for some activity and show a custom modal UI on some conditions. I created a simple extension with a inprocess native messaging UWP module and tried to show simple message box.
Obviously, code in OnAppServiceRequestReceived handler like that:
var dialog = new MessageDialog("Test");
await dialog.ShowAsync();
doesn't work and gives follow error
An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.ni.dll but was not handled in user code
WinRT information: This API must be called from a thread with a CoreWindow or a window must have been set explicitly.
Not sure is it possible to get Edge main window somehow or create own UI thread that will be able to handle that. I also tried that way:
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
async () =>
{
// UI update code goes here!
var dialog = new MessageDialog("Your message here");
await dialog.ShowAsync();
});
but it gives NullReferenceException, which means that code executes in separate universal windows application, however i wonder if it possible to access parent app in same process.
I'll appreciate any your ideas.
Update 16.03.2017
I found how to do modal dialogs from Desktop Bridge application. Everything works fine if i use GetForegroundWindow WinApi function result as a parent for a dialog. However still not sure how to do that without Desktop Bridge component.