public OAuthLogonWebView(CustomOAuth2Authenticator platformOAuthClient)
        {
            this.platformOAuthClient = platformOAuthClient;
            InitializeComponent();

            this.Loaded += (object sender, RoutedEventArgs e) =>
            {
                //Add the message hook in the code behind since I got a weird bug when trying to do it in the XAML
                //webBrowser.MessageHook += WebBrowser_MessageHook;

                //Delete the cookies since the last authentication
                //DeleteCookies();

                //Create the destination URL
                var getUriTask = platformOAuthClient.GetInitialUrlAsync();
                getUriTask.Wait();

                var destinationURL = getUriTask.Result;
                webBrowser.Navigate(destinationURL);
            };
        }
        public void New(object parameter, string accountStoreKeyName, string clientId, string scope, Uri authorizeUrl, Uri redirectUrl)
        {
            if (auth != null)
            {
                auth.Completed -= OAuth2Authenticator_Completed;
                auth.Error     -= OAuth2Authenticator_Error;
            }

            this.accountStoreKeyName = accountStoreKeyName;

            LoadAccount();

            auth = new CustomOAuth2Authenticator(
                clientId: clientId,
                scope: scope,
                authorizeUrl: authorizeUrl,
                redirectUrl: redirectUrl);

            auth.Completed += OAuth2Authenticator_Completed;
            auth.Error     += OAuth2Authenticator_Error;
        }