Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Magazine         magazine     = new Magazine();
            MagazineEditForm magazineForm = new MagazineEditForm(magazine, authors);

            var res = magazineForm.ShowDialog();

            if (res == DialogResult.OK)
            {
                listBox1.Items.Add(magazine);
                magazines.Add(magazine);
            }
            else if (res != DialogResult.Abort)
            {
                MessageBox.Show("Nothing changed");
            }
        }
Beispiel #2
0
        private void buttonEditSelected_Click(object sender, EventArgs e)
        {
            int index = listBox1.SelectedIndex;

            if (index < 0 || index >= magazines.Count)
            {
                MessageBox.Show("Choose 1 magazine!");
                return;
            }
            MagazineEditForm magazineForm = new MagazineEditForm(magazines[index], authors);

            var res = magazineForm.ShowDialog();

            if (res == DialogResult.OK)
            {
                listBox1.Items[index] = magazines[index];
            }
            else if (res != DialogResult.Abort)
            {
                MessageBox.Show("Nothing changed");
            }
        }