示例#1
0
        private void GetAccessToken()
        {
            this.AccessTokenIsCheked = true;

            // create login form
            var login = new CodeProjectLogin
                        (
                "92mWWELc2DjcL-6tu7L1Py6yllleqSCt",
                "YJXrk_Vzz4Ps02GqmaUY-aSLucxh4kfLq6oq0CtiukPfvbzb9yQG69NeDr2yiV9M",
                "https://oauthproxy.nemiro.net/"
                        );

            // set owner
            login.Owner = this;
            // show login form
            login.ShowDialog();
            // authorization is success
            if (login.IsSuccessfully)
            {
                // save the access token to the application settings
                Properties.Settings.Default.AccessToken = login.AccessTokenValue;
                Properties.Settings.Default.Save();
                // update the list of messages
                toolStripComboBox1.SelectedIndex = 0;
                toolStripComboBox1_SelectedIndexChanged(toolStripComboBox1, null);
            }
            // is fails
            else
            {
                if (MessageBox.Show("Please Click OK to login on CodeProject or CANCEL for exit from the program.", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel)
                {
                    this.Close();
                }
                else
                {
                    this.GetAccessToken();
                }
            }
        }
示例#2
0
    private void GetAccessToken()
    {
      this.AccessTokenIsCheked = true;

      // create login form
      var login = new CodeProjectLogin
      (
        "92mWWELc2DjcL-6tu7L1Py6yllleqSCt", 
        "YJXrk_Vzz4Ps02GqmaUY-aSLucxh4kfLq6oq0CtiukPfvbzb9yQG69NeDr2yiV9M", 
        "https://oauthproxy.nemiro.net/"
      );
      // set owner
      login.Owner = this;
      // show login form
      login.ShowDialog();
      // authorization is success
      if (login.IsSuccessfully)
      {
        // save the access token to the application settings
        Properties.Settings.Default.AccessToken = login.AccessTokenValue;
        Properties.Settings.Default.Save();
        // update the list of messages
        toolStripComboBox1.SelectedIndex = 0;
      }
      // is fails
      else
      {
        if (MessageBox.Show("Please Click OK to login on CodeProject or CANCEL for exit from the program.", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Cancel)
        {
          this.Close();
        }
        else
        {
          this.GetAccessToken();
        }
      }
    }