Beispiel #1
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            using (var form = new LoginForm(this))
            {
                if (form.ShowDialog(this) != DialogResult.OK)
                {
                    Dispose();
                    return;
                }

                _api = form.Api;
            }
        }
Beispiel #2
0
        private void _acceptButton_Click(object sender, EventArgs e)
        {
            try
            {
                var api = new JiraApi(_site.Text, _userName.Text, _password.Text, _statusBarProvider);

                api.Request("rest/api/2/issue/createmeta", null, null);

                Api = api;

                using (var key = Program.BaseKey)
                {
                    key.SetValue("User name", _userName.Text);
                    key.SetValue("Site", _site.Text);
            #if DEBUG
                    key.SetValue("Password", _password.Text);
            #endif
                }

                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                string message;

                if ((ex as WebException)?.Response != null && ((HttpWebResponse)((WebException)ex).Response).StatusCode == HttpStatusCode.Forbidden)
                    message = "Invalid user name or password";
                else
                    message = "Could not connect to JIRA" + Environment.NewLine + Environment.NewLine + ex.Message + " (" + ex.GetType().FullName + ")";

                MessageBox.Show(
                    this,
                    message,
                    Text,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );
            }
        }