private void RenameSave_Click(object sender, EventArgs e) { if (listSaveStates.SelectedIndex < 0) { return; } var newSaveState = new NewSaveState(DialogAction.Rename, GetSaveNames(_categories[listCategories.SelectedIndex])); newSaveState.SaveStateName = _saveStates[listSaveStates.SelectedIndex].SaveStateName; newSaveState.ShowDialog(); if (newSaveState.DialogResult == DialogResult.OK) { var config = BlossomConfig.GetBlossomConfig(); var categoryName = _categories[listCategories.SelectedIndex].CategoryName; var originalSaveState = _categories[listCategories.SelectedIndex].SaveStates[listSaveStates.SelectedIndex]; _categories[listCategories.SelectedIndex].SaveStates[listSaveStates.SelectedIndex] = Helper.RenameSave(originalSaveState, categoryName, newSaveState.SaveStateName); _saveStates = new BindingList <SaveState>(_categories[listCategories.SelectedIndex].SaveStates); BindSaves(); } Helper.WriteSaveInfo(_categories); }
private void SaveCurrentGameState_Click(object sender, EventArgs e) { var newSaveState = new NewSaveState(DialogAction.New, GetSaveNames(_categories[listCategories.SelectedIndex])); newSaveState.ShowDialog(); if (newSaveState.DialogResult == DialogResult.OK) { var selectedCategory = _categories[listCategories.SelectedIndex]; var save = Helper.CreateSaveState(selectedCategory.CategoryName, newSaveState.SaveStateName, _saveSlot); save.PositionNumber = selectedCategory.SaveStates.Count; _categories[listCategories.SelectedIndex].SaveStates.Add(save); _saveStates = new BindingList <SaveState>(_categories[listCategories.SelectedIndex].SaveStates); BindSaves(); } Helper.WriteSaveInfo(_categories); }