private void button1_Click(object sender, EventArgs e) { if (_queen.AssignWork(workerBeeJob.Text, (int)shifts.Value)) { MessageBox.Show("The job '" + workerBeeJob.Text + "` will be done in"); } }
private void buttonAssignJob_Click(object sender, EventArgs e) { if (!queen.AssignWork(comboBoxWorkerBeeJob.Text, (int)numericUpDownShifts.Value)) { MessageBox.Show($"Для этого задания рабочих нет '{comboBoxWorkerBeeJob.Text}'", "Матка говорит..."); } else { MessageBox.Show($"Задание '{comboBoxWorkerBeeJob.Text}' будет закончено через {numericUpDownShifts.Value} смен", "Матка говорит..."); } }
/// <summary> /// It is a method which returns report to QueenView. The report tells you /// if you've found the right worker to selected job. /// </summary> /// <param name="jobToDo"></param> /// <param name=shiftNumber"></param> /// <returns></returns> public string AssignWork(Job jobToDo, int value) { string report = ""; if (queen.AssignWork(townHall, jobToDo, value)) { report += ": znaleziono wolną pszczołę\n"; AmountOfWorkersChanged(); } else { report += ": nie znaleziono wolnej pszczoły\n"; } return(report); }