/// <summary>
        /// Handler that is called when HTML title is changed in browser (i.e. content is reloaded)
        /// Once user has signed in to OAth page and authorised this app the OAuth code is returned in the HTML content
        /// </summary>
        /// <param name="sender">The web browser control</param>
        /// <param name="e">The event</param>
        /// <remarks>This assumes redirect URL is http://desktop</remarks>
        private void WebBrowser_DocumentTitleChanged(object sender, EventArgs e)
        {
            var webB = (WebBrowser)sender;

            //Check if OAuth code is returned
            if (webB.DocumentText.Contains("code="))
            {
                _code = ExtractSubstring(webB.DocumentText, "code=", "<");
                GetTokenComplete?.Invoke(this, new EventArgs());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Handler that is called when HTML title is changed in browser (i.e. content is reloaded)
        /// Once user has signed in to OAth page and authorised this app the OAuth code is returned in the HTML content
        /// </summary>
        /// <param name="sender">The web browser control</param>
        /// <param name="e">The event</param>
        /// <remarks>This assumes redirect URL is http://desktop</remarks>
        private void WebBrowser_DocumentTitleChanged(object sender, EventArgs e)
        {
            var webB = (WebBrowser)sender;
            var frm  = (Form)webB.Parent;

            //Check if OAuth code is returned
            if (webB.DocumentText.Contains("code="))
            {
                // frm.Close();
                GetTokenComplete?.Invoke(this, new EventArgs());
                // WaitHandler?.Set();
            }
        }