コード例 #1
0
        /// <summary>
        /// Authenticates the application.
        /// </summary>
        private void Authorize()
        {
            using (ClientRegistrationForm form = new ClientRegistrationForm())
            {
                form.Register(RegistrationMode.IRC);
                while (!form.IsFinished && form.DialogResult == DialogResult.None)
                {
                    Application.DoEvents();
                }
                form.Hide();

                if (!string.IsNullOrEmpty(form.AuthenticationKey))
                {
                    this.uiPasswordTextBox.Text = form.AuthenticationKey;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Authenticates the application.
        /// </summary>
        private void Authorize()
        {
            using (ClientRegistrationForm form = new ClientRegistrationForm())
            {
                form.Register();
                while (!form.IsFinished && form.DialogResult == DialogResult.None)
                {
                    Application.DoEvents();
                }
                form.Hide();

                if (!string.IsNullOrEmpty(form.AuthenticationKey))
                {
                    this.uiAuthenticationStatusLabel.Text      = "Access token received. Please click 'OK' to save the new key.";
                    this.uiAuthenticationStatusLabel.ForeColor = Color.Blue;
                    this.uiAuthenticationKeyTextBox.Text       = form.AuthenticationKey;
                }
                else
                {
                    this.uiAuthenticationStatusLabel.Text      = "Unable to get access token.";
                    this.uiAuthenticationStatusLabel.ForeColor = Color.DarkRed;
                }
            }
        }