private void добавитьToolStripMenuItem2_Click(object sender, EventArgs e) { WorkLoadForm f2 = new WorkLoadForm(); if (f2.ShowDialog() == DialogResult.OK) { if (f2.workload.IsValid) { Workload temp = f2.workload; Univer.Workloads.Add(temp); updateListWorkLoad(); } } }
private void изменитьToolStripMenuItem2_Click(object sender, EventArgs e) { if (Univer.Workloads.Count != 0) { if (listViewWorkload.SelectedItems.Count == 1) { Workload tempWorkload = Univer.Workloads[listViewWorkload.SelectedIndices[0]]; WorkLoadForm f2 = new WorkLoadForm(tempWorkload); if (f2.ShowDialog() == DialogResult.OK) { if (f2.workload.IsValid) { Workload temp = f2.workload; Univer.Workloads[listViewWorkload.SelectedIndices[0]] = temp; } } } updateListWorkLoad(); } else { MessageBox.Show("Ошибка! Сначала добавьте нагрузку", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }