public void showFormIfNeeded(string currentGameName, UserSettings currentUserSettingObject, bool useDefaultConfig) { string currentSettingName = ""; List<string> configNames = null; // We receive as parameter the current game name. However it may not be the current config. if (!useDefaultConfig) currentSettingName = currentGameName; userSettingObject = currentUserSettingObject; configNames = userSettingObject.GetAllConfigsGameNameFromCurrentUserSettings(); configNames.Remove(currentSettingName); configNames.Insert(0, Constants.settingNameForFactorySettings); // In the list, no game string value is nothing. Replace it with No Game so user understands it for (int i = 0; i < configNames.Count; i++) if (configNames[i] == "") configNames[i] = Constants.noGameConfigNameToDisplayToUser; cbxConfigToPickFrom.DataSource = configNames; this.ShowDialog(); }
public void PrepareFormAndShowIfNeeded(UserSettings currentUserSettingObject, string settingsPath, string fileName) { List<string> configNames = null; this.settingsPath = settingsPath; this.fileName = fileName; cbxConfigToDelete.Enabled = true; btnDelete.Enabled = true; btnDeleteAll.Enabled = true; userSettingObject = currentUserSettingObject; configNames = userSettingObject.GetAllConfigsGameNameFromCurrentUserSettings(); if (configNames.Count == 0) { MessageBox.Show("No configs!", "C# MegaMan Engine", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { // Buil list // In the list, no game string value is nothing. Replace it with No Game so user understands it cbxConfigToDelete.Items.Clear(); for (int x = 0; x < configNames.Count; x++) { if (string.IsNullOrWhiteSpace(configNames[x])) configNames[x] = Constants.noGameConfigNameToDisplayToUser; cbxConfigToDelete.Items.Add(configNames[x]); } cbxConfigToDelete.SelectedIndex = 0; this.ShowDialog(); } }