Example #1
0
        void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
        {
            FacebookOAuthResult result;

            if (Fbclient.TryParseOAuthCallbackUrl(e.Url, out result))
            {
                // The url is the result of OAuth 2.0 authentication
                if (result.IsSuccess)
                {
                    accesstoken = result.AccessToken;
                    dynamic name = Fbclient.Get(userName);
                    richTextBox1.Text += "\n\n" + (string)name["username"] + "\n\n";
                    pageid             = (string)name["username"];
                    FacebookMessanger messenger = new FacebookMessanger();
                    try
                    {
                        messenger.ShareOnFB(Caption, Description, photourl, accesstoken, userName, IsPage);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    var errorDescription = result.ErrorDescription;
                    var errorReason      = result.ErrorReason;
                }
            }
            else
            {
                // The url is NOT the result of OAuth 2.0 authentication.
            }
        }