private void buttonIzmNameofTest_Click(object sender, EventArgs e) { if (this.listBoxTest.SelectedIndex != -1 && this.listBoxPredmet.SelectedIndex != -1) { FormPredmet FP = new FormPredmet("Змінити назву тесту", true, this.listBoxTest.SelectedItem.ToString()); FP.ShowDialog(); if (FP.DialogResult == DialogResult.OK) { this.CurrentTeacher.GetArrayOfPredmet()[this.listBoxPredmet.SelectedIndex].RenameTest(this.listBoxTest.SelectedItem, FP.textBox1.Text); FP.Close(); } this.listBoxTest.Items.Clear(); Predmet SelectPredmet = new Predmet(); SelectPredmet = (Predmet)this.listBoxPredmet.SelectedItem; if (SelectPredmet != null) { this.listBoxTest.Items.AddRange(SelectPredmet.GetTests()); } if (this.listBoxTest.Items.Count > 0) { this.listBoxTest.SelectedIndex = 0; this.buttonDelTest.Enabled = this.buttonIzmNameofTest.Enabled = this.menuItem17.Enabled = this.menuItem18.Enabled = this.toolStripMenuItem8.Enabled = this.toolStripMenuItem9.Enabled = true; } else { this.buttonDelTest.Enabled = this.buttonIzmNameofTest.Enabled = this.menuItem17.Enabled = this.menuItem18.Enabled = this.toolStripMenuItem8.Enabled = this.toolStripMenuItem9.Enabled = false; } } }
private void buttonAddPredmet_Click(object sender, EventArgs e) { FormPredmet FP = new FormPredmet("Додати навчальну дисципліну до списку"); FP.ShowDialog(); if (FP.DialogResult == DialogResult.OK) { this.CurrentTeacher.AddPredmet(new Predmet(FP.textBox1.Text, this.CurrentTeacher.GetID())); FP.Close(); this.Focus(); this.Visible = true; this.Reload(); } }
private void buttonIzmPredmet_Click(object sender, EventArgs e) { if (this.listBoxPredmet.SelectedIndex != -1) { FormPredmet FP = new FormPredmet("Змінити назву навчальної дисципліни", this.listBoxPredmet.SelectedItem.ToString()); FP.ShowDialog(); if (FP.DialogResult == DialogResult.OK) { this.CurrentTeacher.GetArrayOfPredmet()[this.listBoxPredmet.SelectedIndex].SetNameOfPredmet(FP.textBox1.Text); FP.Close(); this.Focus(); Reload(); } } else { MessageBox.Show("Дисципліна не вибрана"); } }