public void addDPercentTable(DPercentTable add) { int dupCount = 0; foreach (DPercentTable table in tables) { if (table.Name == add.Name) { dupCount++; } } if (dupCount > 0) { add.Name += " " + (dupCount + 1).ToString(); } tables.Add(add); UpdateTableList(); tableList.SelectedItem = add.Name; button1.Enabled = true; button2.Enabled = true; npcAttackButton.Enabled = true; BattleIO auto = new BattleIO(); auto.AutoSaveDPercentList(tables, Program.activeSettings); }
private void button1_Click(object sender, EventArgs e) { if (selectedTable != null) { DialogResult result = MessageBox.Show("Remove " + selectedTable.Name + "?", "Delete Table", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { int nextIndex = tables.IndexOf(selectedTable) - 1; if (nextIndex < 0) { nextIndex = 0; } tables.Remove(selectedTable); selectedTable = new DPercentTable(); UpdateTableList(); UpdateResultsTable(); if (nextIndex < tables.Count) { tableList.SelectedItem = tables.ElementAt(nextIndex).Name; } BattleIO auto = new BattleIO(); auto.AutoSaveDPercentList(tables, Program.activeSettings); } } if (tables.Count <= 0) { button1.Enabled = false; button2.Enabled = false; npcAttackButton.Enabled = false; } }
public void AutoSave() { BattleIO auto = new BattleIO(); if (tables != null) { auto.AutoSaveDPercentList(tables, Program.activeSettings); } }