private void btnRenameProfile_Click(object sender, EventArgs e) { if (cbProfiles.SelectedItem is string profileName) { using var promptDlg = new PromptForm(PromptForm.PromptType.RenameProfile, IsValidAndAvailableProfileName) { Value = profileName, MaxValueLength = 32 }; if (promptDlg.ShowDialog(this) == DialogResult.OK) { var newProfileName = promptDlg.Value.Trim(); if (_profileManager.RenameProfile(profileName, newProfileName)) { if (_appliedProfileName != null && _appliedProfileName.Equals(profileName)) { _appliedProfileName = newProfileName; } UpdateProfiles(newProfileName); } else { MessageBox.Show(this, Resources.GameSettings_ProfileError_Text, Resources.GameSettings_Error_Title, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void btnNewProfile_Click(object sender, EventArgs e) { using var promptDlg = new PromptForm(PromptForm.PromptType.CreateProfile, IsValidAndAvailableProfileName) { MaxValueLength = 32 }; if (promptDlg.ShowDialog(this) == DialogResult.OK) { var profileName = promptDlg.Value.Trim(); if (_profileManager.CreateProfile(profileName, GetCurrentConfigData())) { UpdateProfiles(profileName); } else { MessageBox.Show(this, Resources.GameSettings_ProfileError_Text, Resources.GameSettings_Error_Title, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }