private async void SaveProfileForm_ProfileAdded(object sender, ProfileEventArgs e)
        {
            // Persist the new AWS credentials profile!
            using (new WaitCursor()) {
                ProfileManager.RegisterProfile(e.ProfileName, e.AccessKeyId, e.SecretAccessKey);
            }

            // Log this information
            string msg = string.Format(ProfileAdded, e.ProfileName);

            addLog(msg);

            // Reset the data source for the profiles combobox
            // Select the profile that was just added
            ProfileSettingsBase[] profiles = await bindProfilesAsync();

            ComboProfiles.SelectedIndex = profiles.Length - 1;
        }
Example #2
0
        private void saveNew(string name, string accessKeyId, string secretKey)
        {
            // Warn the user if they are about to overwrite an existing profile
            try {
                ProfileSettingsBase existing = ProfileManager.GetProfile(name);
                string       msg             = string.Format(DuplicateProfileText, name);
                DialogResult result          = MessageBox.Show(msg, DuplicateProfileCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                {
                    this.DialogResult = DialogResult.None;
                    return;
                }
            }
            catch (AmazonClientException) { }

            // Raise an Added event with the new values
            ProfileEventArgs args = new ProfileEventArgs(name, accessKeyId, secretKey);

            ProfileAdded?.Invoke(this, args);
        }