OAuthAuthorizationHandler doesn't work with WinForms application

2317
0
04-04-2016 12:42 PM
MattBryant
New Contributor II


I've created a WPF map control which I've embedded in a Windows Forms control using the ElementHost control.  When attempting to load a secured a webmap no sign in window is produced. 

At the recommendation of Michael Branscomb, I was able to dig into the source code of the OAuthAuthorizationHandler since it's supplied with the ArcGIS.Runtime.Toolkit.  It turns out that the source code assumes that the host application is a WPF application by calling Application.Current to get a hook on the application's Dispatcher and MainWindow.  This allows the sign in window to be centered and modal.

var dispatcher = Application.Current.Dispatcher;

Since my application is a Windows Forms application I modified a copy of the OAuthAuthorizationHandler to open the sign in window on it's own thread as a non-modal window if the application is not a WPF application.  This works and I've attached the source code if anyone is interested.

My question /  concern now has to do with Quartz.  At the Devsummit it was stated that Quartz will have better Authentication support.  I assume that means more black-boxed.  Will I have to, or even be able to, make a similar hack?  Or better yet, can the Quartz team look at this issue and add support for non-WPF applications?

Thanks,

Matt

0 Kudos
0 Replies