private void btnBack_Click(object sender, EventArgs e)
 {
     if ((int)m_aaStatus > 0)
     {
         m_aaStatus = (AddAccountStatus)((int)m_aaStatus - 1);
         UpdateFromStatus();
     }
 }
        private void Reset()
        {
            ToggleButtons(true);

            //get empty set of credentials
            m_oaCredentials = OAuthAPI.GetCredentials("", "");
            m_aaStatus      = (AddAccountStatus)0;
            UpdateFromStatus();

            txtPin.Text = "";
            txtUrl.Text = "";
        }
 private void m_oaApi_AccessTokenReceived(object sender, bool bSucceeded, string sErrorMessage, OAuthCredentials oaCredentials)
 {
     if (bSucceeded)
     {
         m_oaCredentials = oaCredentials;
         ToggleLoadingAnimation(false);
         ToggleButtons(true);
         m_aaStatus = (AddAccountStatus)((int)m_aaStatus + 1);
         UpdateFromStatus();
     }
     else
     {
         MessageBox.Show(sErrorMessage, "OAuth Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         m_aaStatus = AddAccountStatus.Pin;
         UpdateFromStatus();
         ToggleButtons(true);
         ToggleLoadingAnimation(false);
     }
 }
        private void btnNext_Click(object sender, EventArgs e)
        {
            switch (m_aaStatus)
            {
            case AddAccountStatus.Welcome:
                ToggleLoadingAnimation(true);
                ToggleButtons(false);
                Application.DoEvents();
                m_oaApi.GetRequestToken(m_oaCredentials);
                break;

            case AddAccountStatus.URL:
                m_aaStatus = (AddAccountStatus)((int)m_aaStatus + 1);
                UpdateFromStatus();
                break;

            case AddAccountStatus.Pin:
                ToggleLoadingAnimation(true);
                ToggleButtons(false);
                Application.DoEvents();

                try { m_oaApi.GetAccessToken(m_oaCredentials, txtPin.Text); }
                catch (UnavailableAccessTokenException)
                {
                    MessageBox.Show("An error occurred authenticating with the pin you supplied.  Please enter the correct pin and try again.", "OAuth Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_aaStatus = AddAccountStatus.Pin;
                    UpdateFromStatus();
                    ToggleButtons(true);
                    ToggleLoadingAnimation(false);
                }

                break;

            case AddAccountStatus.Done:
                if (OAuthDanceComplete != null)
                {
                    OAuthDanceComplete(this, m_oaCredentials);
                }

                this.Hide();
                break;
            }
        }
 private void m_oaApi_AccessTokenReceived(object sender, bool bSucceeded, string sErrorMessage, OAuthCredentials oaCredentials)
 {
     if (bSucceeded)
     {
         m_oaCredentials = oaCredentials;
         ToggleLoadingAnimation(false);
         ToggleButtons(true);
         m_aaStatus = (AddAccountStatus)((int)m_aaStatus + 1);
         UpdateFromStatus();
     }
     else
     {
         MessageBox.Show(sErrorMessage, "OAuth Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         m_aaStatus = AddAccountStatus.Pin;
         UpdateFromStatus();
         ToggleButtons(true);
         ToggleLoadingAnimation(false);
     }
 }
        private void btnNext_Click(object sender, EventArgs e)
        {
            switch (m_aaStatus)
            {
                case AddAccountStatus.Welcome:
                    ToggleLoadingAnimation(true);
                    ToggleButtons(false);
                    Application.DoEvents();
                    m_oaApi.GetRequestToken(m_oaCredentials); 
                    break;

                case AddAccountStatus.URL:
                    m_aaStatus = (AddAccountStatus)((int)m_aaStatus + 1);
                    UpdateFromStatus();
                    break;

                case AddAccountStatus.Pin:
                    ToggleLoadingAnimation(true);
                    ToggleButtons(false);
                    Application.DoEvents();

                    try { m_oaApi.GetAccessToken(m_oaCredentials, txtPin.Text); }
                    catch (UnavailableAccessTokenException)
                    {
                        MessageBox.Show("An error occurred authenticating with the pin you supplied.  Please enter the correct pin and try again.", "OAuth Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        m_aaStatus = AddAccountStatus.Pin;
                        UpdateFromStatus();
                        ToggleButtons(true);
                        ToggleLoadingAnimation(false);
                    }

                    break;

                case AddAccountStatus.Done:
                    if (OAuthDanceComplete != null)
                        OAuthDanceComplete(this, m_oaCredentials);

                    this.Hide();
                    break;
            }
        }
 private void btnBack_Click(object sender, EventArgs e)
 {
     if ((int)m_aaStatus > 0)
     {
         m_aaStatus = (AddAccountStatus)((int)m_aaStatus - 1);
         UpdateFromStatus();
     }
 }
        private void Reset()
        {
            ToggleButtons(true);

            //get empty set of credentials
            m_oaCredentials = OAuthAPI.GetCredentials("", "");
            m_aaStatus = (AddAccountStatus)0;
            UpdateFromStatus();

            txtPin.Text = "";
            txtUrl.Text = "";
        }