Exemplo n.º 1
0
    /// <summary>
    /// Posts the flight to facebook, setting up authorization as needed.
    /// </summary>
    /// <param name="le">The flight to post</param>
    /// <returns>The Facebook result, empty if not posted or error</returns>
    public void PostFlight(IPostable le)
    {
        if (le == null)
        {
            throw new ArgumentNullException("le");
        }

        Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name);

        if (pf.CanPostFacebook())
        {
            FDefaultFacebookCheckboxState = true;
            new FacebookPoster().PostToSocialMedia(le, Page.User.Identity.Name, Request.Url.Host);
        }
        else
        {
            MFBFacebook.NotifyFacebookNotSetUp(pf.UserName);
        }
    }
Exemplo n.º 2
0
    private void HandleOAuthRedirect()
    {
        if (!String.IsNullOrEmpty(Request.Params[szParamDropboxAuth])) // redirect from Dropbox oAuth request.
        {
            m_pf.DropboxAccessToken = new MFBDropbox().ConvertToken(Request).AccessToken;
            m_pf.FCommit();

            Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=backup", Request.Path));
        }
        if (!String.IsNullOrEmpty(Request.Params[szParamGDriveAuth])) // redirect from GDrive oAuth request.
        {
            m_pf.GoogleDriveAccessToken = new GoogleDrive().ConvertToken(Request);
            m_pf.FCommit();

            Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=backup", Request.Path));
        }
        if (!String.IsNullOrEmpty(Request.Params[szParam1DriveAuth])) // redirect from OneDrive oAuth request.
        {
            m_pf.OneDriveAccessToken = (DotNetOpenAuth.OAuth2.AuthorizationState)Session[OneDrive.TokenSessionKey];
            m_pf.FCommit();

            Response.Redirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=backup", Request.Path));
        }
        if (!String.IsNullOrEmpty(Request.Params[MFBFacebook.OAuthParam]))   // redirect from FB oAuth request
        {
            try
            {
                m_pf.FacebookAccessToken = MFBFacebook.ConvertToken(Request);
                m_pf.FCommit();
                mfbFacebook1.PostPendingFlight();
            }
            catch (MyFlightbookException) { }

            Response.Redirect(SocialNetworkAuthorization.PopRedirect(String.Format(CultureInfo.InvariantCulture, "{0}?pane=social", Request.Path)));
        }
    }
Exemplo n.º 3
0
 protected void lnkSetUpFacebook_Click(object sender, EventArgs e)
 {
     MFBFacebook.Authorize();
 }
 protected void lnkSetUpFacebook_Click(object sender, EventArgs e)
 {
     SocialNetworkAuthorization.PushRedirect(Request.Url.PathAndQuery);
     MFBFacebook.Authorize();
 }