private void btnChangeUpgrade_Click(object sender, EventArgs e) { int index = lbxUpgrades.SelectedIndex; if (index < 0) { return; } var upgradeForm = new AddUpgradeForm(); foreach (var upgrade in Upgrades) { upgradeForm.Upgrades.Add(upgrade.Key); } var selectedUpgrade = Upgrades[index]; upgradeForm.UpgradeType = selectedUpgrade.Type; upgradeForm.UpgradeName = selectedUpgrade.Name; upgradeForm.UpgradeKey = selectedUpgrade.Key; upgradeForm.UpgradeValue = selectedUpgrade.Value; upgradeForm.UpgradePrice = selectedUpgrade.Price; upgradeForm.UpgradeRequirements = selectedUpgrade.Requirements; upgradeForm.UpgradeDescription = selectedUpgrade.Description; if (upgradeForm.ShowDialog() == DialogResult.OK) { Upgrades[index] = new Upgrade { Type = upgradeForm.UpgradeType, Name = upgradeForm.UpgradeName, Key = upgradeForm.UpgradeKey, Price = upgradeForm.UpgradePrice, Value = upgradeForm.UpgradeValue, Requirements = upgradeForm.UpgradeRequirements, Description = upgradeForm.UpgradeDescription }; } UpdateUpgradeList(); lbxUpgrades.SelectedIndex = index; }
private void btnAddUpgrade_Click(object sender, EventArgs e) { var upgradeForm = new AddUpgradeForm(); foreach (var upgrade in Upgrades) { upgradeForm.Upgrades.Add(upgrade.Key); } if (upgradeForm.ShowDialog() != DialogResult.OK) { return; } Upgrades.Add(new Upgrade { Type = upgradeForm.UpgradeType, Name = upgradeForm.UpgradeName, Key = upgradeForm.UpgradeKey, Price = upgradeForm.UpgradePrice, Value = upgradeForm.UpgradeValue, Requirements = upgradeForm.UpgradeRequirements, Description = upgradeForm.UpgradeDescription }); UpdateUpgradeList(); }
private void btnChangeUpgrade_Click(object sender, EventArgs e) { int index = lbxUpgrades.SelectedIndex; if (index < 0) return; var upgradeForm = new AddUpgradeForm(); foreach (var upgrade in Upgrades) { upgradeForm.Upgrades.Add(upgrade.Key); } var selectedUpgrade = Upgrades[index]; upgradeForm.UpgradeType = selectedUpgrade.Type; upgradeForm.UpgradeName = selectedUpgrade.Name; upgradeForm.UpgradeKey = selectedUpgrade.Key; upgradeForm.UpgradeValue = selectedUpgrade.Value; upgradeForm.UpgradePrice = selectedUpgrade.Price; upgradeForm.UpgradeRequirements = selectedUpgrade.Requirements; upgradeForm.UpgradeDescription = selectedUpgrade.Description; if (upgradeForm.ShowDialog() == DialogResult.OK) { Upgrades[index] = new Upgrade { Type = upgradeForm.UpgradeType, Name = upgradeForm.UpgradeName, Key = upgradeForm.UpgradeKey, Price = upgradeForm.UpgradePrice, Value = upgradeForm.UpgradeValue, Requirements = upgradeForm.UpgradeRequirements, Description = upgradeForm.UpgradeDescription }; } UpdateUpgradeList(); lbxUpgrades.SelectedIndex = index; }
private void btnAddUpgrade_Click(object sender, EventArgs e) { var upgradeForm = new AddUpgradeForm(); foreach (var upgrade in Upgrades) { upgradeForm.Upgrades.Add(upgrade.Key); } if (upgradeForm.ShowDialog() != DialogResult.OK) return; Upgrades.Add(new Upgrade { Type = upgradeForm.UpgradeType, Name = upgradeForm.UpgradeName, Key = upgradeForm.UpgradeKey, Price = upgradeForm.UpgradePrice, Value = upgradeForm.UpgradeValue, Requirements = upgradeForm.UpgradeRequirements, Description = upgradeForm.UpgradeDescription }); UpdateUpgradeList(); }