private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            try
            {
                // whenever the browser navigates to a new url, try parsing the url.
                // the url may be the result of OAuth 2.0 authentication.

                var fb = new FacebookClient();
                FacebookOAuthResult oauthResult;
                if (fb.TryParseOAuthCallbackUrl(e.Url, out oauthResult))
                {
                    // The url is the result of OAuth 2.0 authentication
                    if (oauthResult.IsSuccess)
                    {
                        var accesstoken = oauthResult.AccessToken;
                        //webBrowser.Hide();
                        FacebookPostForm fpf = new FacebookPostForm(accesstoken.ToString(), uploadFilePath);
                        fpf.Show();
                        WinInetHelper.EndBrowserSession();
                        this.Hide();
                    }
                    else
                    {
                        var errorDescription = oauthResult.ErrorDescription;
                        var errorReason      = oauthResult.ErrorReason;
                    }
                }
                else
                {
                    // The url is NOT the result of OAuth 2.0 authentication.
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
            }
        }
 public FacebookBrowserLogin(string filePath)
 {
     WinInetHelper.SupressCookiePersist();
     uploadFilePath = filePath;
     InitializeComponent();
 }