Exemplo n.º 1
0
        private async void btnAccept_Click(object sender, EventArgs e)
        {
            string pin = txtPinCode.Text.Trim();

            pictureBox1.Visible = true;
            btnAccept.Enabled   = false;
            btnCancel.Enabled   = false;
            Text = "Please wait...";

            try
            {
                await oauthHelper.Authenticate(pin);
            }
            catch (Exception ex)
            {
                MessageBox.Show("An unexpected error occurred while authorizing the imgur account. Please try again.");
                ex.ToExceptionless().Submit();
                return;
            }
            finally
            {
                Text = "Authentication";
                pictureBox1.Visible = false;
                btnAccept.Enabled   = true;
                btnCancel.Enabled   = true;
            }
            Close();
            DialogResult = DialogResult.OK;
        }