Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Session[Guid.NewGuid().ToString()] = 1;
        if (!string.IsNullOrEmpty(appkey) && !string.IsNullOrEmpty(appsecret))
        {
            OAuthQQ.SetConsumerKeyAndSecret(appkey, appsecret);
        }

        if (!Page.IsPostBack)
        {
            if (Request["oauth_verifier"] != null)
            {
                WeiBeeType t = WeiBeeType.QQ;
                if (Session["weibeetype"] != null)
                {
                    if (string.Compare(Session["weibeetype"].ToString(), t.ToString()) == 0)
                    {
                        AccessTokenGet(t);
                    }
                }
                Response.Redirect("demo.aspx");
            }
            if (Session[TokenSessionName] == null)
            {
                lbLoginStatus.Text       = "还没登录呢!";
                imageButtonLogin.Visible = true;
                imageButtonSend.Visible  = false;
            }
            else
            {
                ShowLoginInfomation();
            }
        }
    }
Ejemplo n.º 2
0
 private void InitWeiBeeAdd(IWeiBee wb, string txt)
 {
     Token         = wb.GetOAuth().Token;
     TokenSecret   = wb.GetOAuth().TokenSecret;
     WbType        = wb.UserType;
     MessageText   = txt;
     ScheduledTime = DateTime.UtcNow;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create WeiBeeQQ, WeiBeeSohu, or WeiBeeSina according to the WeiBeeType specified
 /// </summary>
 /// <param name="t">type of WeiBee</param>
 /// <returns>IWeiBee</returns>
 public static IWeiBee CreateWeiBeeByType(WeiBeeType t)
 {
     if (dict[t] == null)
     {
         return(null);
     }
     return(dict[t]());
 }
Ejemplo n.º 4
0
 private void InitWeiBeeAdd(string token, string secret, WeiBeeType type, string txt, string pic)
 {
     Token         = token;
     TokenSecret   = secret;
     WbType        = type;
     MessageText   = txt;
     PictureFile   = pic;
     ScheduledTime = DateTime.UtcNow;
 }
Ejemplo n.º 5
0
    private void AccessTokenGet(WeiBeeType wbType)
    {
        var weibee = WeiBeeFactory.CreateWeiBeeByType(wbType);

        weibee.SetOAuth(Session[TokenSessionName].ToString(), Session[TokenSecretSessionName].ToString());
        weibee.GetOAuth().Verifier = Request["oauth_verifier"];
        weibee.GetOAuth().AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]);
        Session[TokenSessionName]       = weibee.GetOAuth().Token;
        Session[TokenSecretSessionName] = weibee.GetOAuth().TokenSecret;
    }
Ejemplo n.º 6
0
 public WeiBeeAdd(string token, string secret, WeiBeeType type, string txt)
 {
     InitWeiBeeAdd(token, secret, type, txt, string.Empty);
 }
Ejemplo n.º 7
0
 public WeiBeeAdd(string token, string secret, WeiBeeType type, string txt, string pic)
 {
     InitWeiBeeAdd(token, secret, type, txt, pic);
 }