Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Add_Card cardAdd = new Add_Card("Create New Card");

            cardAdd.ShowDialog();

            if (cardAdd.newCardName != null)
            {
                listBox1.Items.Add(new DexCard(cardAdd.newCardName));
            }
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem != null)
            {
                DexCard rename = ((DexCard)listBox1.SelectedItem);

                Add_Card newName = new Add_Card("Rename Card");
                newName.ShowDialog();

                if (newName.newCardName != null)
                {
                    rename.name = newName.newCardName;
                }
                else
                {
                    return;
                }

                int oldIndex = listBox1.SelectedIndex;

                listBox1.Items.Remove(rename);
                listBox1.Items.Insert(oldIndex, rename);
            }
        }