コード例 #1
0
ファイル: rasyDataDialog.cs プロジェクト: redhead/CGenPlus
 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
ファイル: rasyDataDialog.cs プロジェクト: redhead/CGenPlus
        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();
        }