private void bRenameItem_Click(object sender, EventArgs e) { using (var newItemForm = new NewItemForm()) { var result = newItemForm.ShowDialog(); if (result == DialogResult.OK) { ITEM_NAMES[n] = newItemForm.ReturnValue; ItemSelectorForm.RenameItem(n, newItemForm.ReturnValue); lIName.Text = newItemForm.ReturnValue; } } }
private void btn_new_item_Click(object sender, EventArgs e) { using (var newItemForm = new NewItemForm()) { var result = newItemForm.ShowDialog(); if (result == DialogResult.OK) { var newList = ITEM_NAMES.ToList(); newList.Add(newItemForm.ReturnValue); ITEM_NAMES = newList.ToArray(); nItem.Maximum = ITEM_NAMES.Length - 1; ItemList.Add(new ItemLogic()); nItem.Value = nItem.Maximum; ItemSelectorForm.AddItem(newItemForm.ReturnValue); } } }
private void btn_new_item_Click(object sender, EventArgs e) { using (var newItemForm = new NewItemForm()) { var result = newItemForm.ShowDialog(); if (result == DialogResult.OK) { var newItem = new JsonFormatLogicItem { Id = newItemForm.ReturnValue, }; _logic.Logic.Add(newItem); _itemsById[newItem.Id] = newItem; nItem.Maximum = _logic.Logic.Count - 1; nItem.Value = nItem.Maximum; //ItemSelectorForm.AddItem(newItemForm.ReturnValue); } } }
private void bRenameItem_Click(object sender, EventArgs e) { using (var newItemForm = new NewItemForm()) { var result = newItemForm.ShowDialog(); if (result == DialogResult.OK) { var oldValue = _logic.Logic[n].Id; var newValue = newItemForm.ReturnValue; foreach (var item in _logic.Logic) { item.RequiredItems = item.RequiredItems.Select(ri => ri == oldValue ? newValue : ri).ToList(); item.ConditionalItems = item.ConditionalItems.Select(c => c.Select(ci => ci == oldValue ? newValue : ci).ToList()).ToList(); } _logic.Logic[n].Id = newValue; //ItemSelectorForm.RenameItem(n, newItemForm.ReturnValue); lIName.Text = newItemForm.ReturnValue; } } }