Пример #1
0
 private void newB_Click(object sender, EventArgs e)
 {
     newRasyDialog newras = new newRasyDialog();
     newras.Text = "Nová rasa";
     this.Hide();
     if (newras.ShowDialog(this) == DialogResult.OK)
     {
         listBox.Items.Add(newras.jmeno);
     }
     newras.Close();
     this.Show();
 }
Пример #2
0
        private void editB_Click(object sender, EventArgs e)
        {
            if (Program.getDB().rasy.FindByjmeno(listBox.Text) == null)
            {
                MessageBox.Show("Pro úpravu musíte vybrat rasu ze seznamu.", "Vyberte rasu", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            newRasyDialog editras = new newRasyDialog(listBox.Text);
            editras.Text = "Úprava rasy";
            this.Hide();

            if (editras.ShowDialog(this) == DialogResult.OK)
            {
                listBox.Items.Insert(listBox.Items.IndexOf(editras.edit), editras.jmeno);
                listBox.Items.RemoveAt(listBox.Items.IndexOf(editras.edit));
            }
            this.Show();
        }