Ejemplo n.º 1
0
        private void _autorize()
        {
            OAuthTokenResponse tokenResponse = new OAuthTokenResponse();

            //tokenResponse = Twitterizer.OAuthUtility.GetRequestToken(consumerKey, consumerSecret, callbackAddy);
            tokenResponse = Twitterizer.OAuthUtility.GetRequestToken(m_config.AppConsumerKey, m_config.AppConsumerSecret, "oob");
            string pin = "";

            if (true)
            {
                // Need to check if the user is a valid user.

                //OAuthTokenResponse tokenResponse = new OAuthTokenResponse();
                //tokenResponse = Twitterizer.OAuthUtility.GetRequestToken(m_config.AppConsumerKey, m_config.AppConsumerSecret, "oob");
                //txt_login.Text = "Token is:  " + tokenResponse.Token.ToString();

                string target = "http://twitter.com/oauth/authorize?oauth_token=" + tokenResponse.Token;
                try
                {
                    System.Diagnostics.Process.Start(target);
                }
                catch (System.ComponentModel.Win32Exception noBrowser)
                {
                    if (noBrowser.ErrorCode == -2147467259)
                    {
                        MessageBox.Show(noBrowser.Message);
                    }
                }
                catch (System.Exception other)
                {
                    MessageBox.Show(other.Message);
                }

                pin = "3470994";       //This WILL NOT WORK. User needs to enter the PIN
                EnterPin enterpin = new EnterPin();
                enterpin.ShowDialog(); //show dialog causes it to wait for user input. Show() would not work
                //pin = Properties.Settings.Default.pin;
            }
            else
            {
                //pin = Properties.Settings.Default.pinSaved;
            }


            tokenResponse2     = OAuthUtility.GetAccessToken(m_config.AppConsumerKey, m_config.AppConsumerSecret, tokenResponse.Token, pin);
            m_config.Autorized = true;
            //txt_login.Text = "App " + tokenResponse2.ScreenName.ToString() + " access allowed.";
        }
        private void _autorize()
        {
            OAuthTokenResponse tokenResponse = new OAuthTokenResponse();
            //tokenResponse = Twitterizer.OAuthUtility.GetRequestToken(consumerKey, consumerSecret, callbackAddy);
            tokenResponse = Twitterizer.OAuthUtility.GetRequestToken(m_config.AppConsumerKey, m_config.AppConsumerSecret, "oob");
            string pin = "";

            if (true)
            {
                // Need to check if the user is a valid user.

                //OAuthTokenResponse tokenResponse = new OAuthTokenResponse();
                //tokenResponse = Twitterizer.OAuthUtility.GetRequestToken(m_config.AppConsumerKey, m_config.AppConsumerSecret, "oob");
                //txt_login.Text = "Token is:  " + tokenResponse.Token.ToString();

                string target = "http://twitter.com/oauth/authorize?oauth_token=" + tokenResponse.Token;
                try
                {
                    System.Diagnostics.Process.Start(target);
                }
                catch (System.ComponentModel.Win32Exception noBrowser)
                {
                    if (noBrowser.ErrorCode == -2147467259)
                        MessageBox.Show(noBrowser.Message);
                }
                catch (System.Exception other)
                {
                    MessageBox.Show(other.Message);
                }

                pin = "3470994"; //This WILL NOT WORK. User needs to enter the PIN
                EnterPin enterpin = new EnterPin();
                enterpin.ShowDialog(); //show dialog causes it to wait for user input. Show() would not work
                //pin = Properties.Settings.Default.pin;
            }
            else
            {
                //pin = Properties.Settings.Default.pinSaved;
            }


            tokenResponse2 = OAuthUtility.GetAccessToken(m_config.AppConsumerKey, m_config.AppConsumerSecret, tokenResponse.Token, pin);
            m_config.Autorized = true;
            //txt_login.Text = "App " + tokenResponse2.ScreenName.ToString() + " access allowed.";
            
        }