Exemplo n.º 1
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     Settings settings = new Settings();
     // if settings.Load fails, there are no settings saved for this application. The user will still be able to set them from frmMain but until then they will be unable to access the API.
     if (!settings.Load())
     {
         if (MessageBox.Show("Close without valid settings?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) ==
             DialogResult.No) { return; }
     }
     Close();
 }
Exemplo n.º 2
0
 private void frmMain_Load(object sender, EventArgs e)
 {
     ClearFeedback();
     EnableFormButtons(false);
     btnLogin.Enabled = false;
     settings = new Settings();
     if (!settings.Load())
     {
         SetSettings();
     }
     else
     {
         btnLogin.Enabled = true;
     }
 }
Exemplo n.º 3
0
        private void frmSettings_Load(object sender, EventArgs e)
        {
            cboEnvironment.DataSource = Enum.GetNames(typeof(WebAPIEnvironment));

            Settings settings = new Settings();
            if (settings.Load())
            {
                txtClientId.Text = settings.ClientId.ToString();
                txtClientSecret.Text = settings.ClientSecret.ToString();
                txtRedirect.Text = settings.RedirectUri.ToString();
                cboEnvironment.SelectedItem = cboEnvironment.Items.OfType<WebAPIEnvironment>().First(env => env == settings.Environment);
            }
            else
            {
                ShowFeedback("These settings must be saved before using the application.");
                cboEnvironment.SelectedIndex = 1; // default to staging
            }
        }