private void bgwLogin_DoWork(object sender, DoWorkEventArgs e)
        {
            var dic = (StringDictionary)e.Argument;

            var t = new TOAuth(dic["AppToken"], dic["AppSecret"]);

            try
            {
                if (dic["UsePin"] == "1")
                {
                    string body = t.Call("POST", "https://api.twitter.com/oauth/request_token", "");

                    dic.Add("UserToken", this.ParseQueryStringParameter("oauth_token", body));
                    dic.Add("UserSecret", this.ParseQueryStringParameter("oauth_token_secret", body));
                }
                else
                {
                    string body = t.Call("POST", "https://api.twitter.com/oauth/request_token", "", TOAuth.ContentType, "http://localhost:58776/");

                    dic.Add("UserToken", this.ParseQueryStringParameter("oauth_token", body));
                    dic.Add("UserSecret", this.ParseQueryStringParameter("oauth_token_secret", body));
                }
            }
            catch (TOAuth.TwitterException ex)
            {
                dic.Add("Error", ex.Message);
            }

            e.Result = dic;
        }
        private void bgwGetToken_DoWork(object sender, DoWorkEventArgs e)
        {
            var dic = (StringDictionary)e.Argument;
            var t = new TOAuth(dic["AppToken"], dic["AppSecret"], dic["UserToken"], dic["UserSecret"]);

            try
            {
                string body = t.Call("POST", "https://api.twitter.com/oauth/access_token", new { oauth_verifier = dic["OauthVerifier"] });

                dic["UserToken"]  = this.ParseQueryStringParameter("oauth_token", body);
                dic["UserSecret"] = this.ParseQueryStringParameter("oauth_token_secret", body);

                dic.Add("UserName", this.ParseQueryStringParameter("screen_name", body));
            }
            catch (TOAuth.TwitterException ex)
            {
                dic.Add("Error", ex.Message);
            }

            e.Result = dic;
        }