private void добавитьToolStripMenuItem2_Click(object sender, EventArgs e) { var workload = new Workload(); _workLoadForm.workload = workload; if (_workLoadForm.ShowDialog() == DialogResult.OK) { try { _univer.AddWorkload(workload); } catch (Exception exception) { MessageBox.Show(exception.Message); } } }
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); } }