This commit is contained in:
Дима 2024-08-30 03:54:36 +04:00
parent cb2629af90
commit 3ff0237fe7

View File

@ -46,15 +46,15 @@ namespace ProjectTrain
/// <summary> /// <summary>
/// Добавление самолета в коллекцию /// Добавление самолета в коллекцию
/// </summary> /// </summary>
/// <param name="plane"></param> /// <param name="train"></param>
private void SetTrain(DrawningTrain? plane) private void SetTrain(DrawningTrain? train)
{ {
if (_company == null || plane == null) if (_company == null || train == null)
{ {
return; return;
} }
if (_company + plane != -1) if (_company + train != -1)
{ {
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");
pictureBoxTrain.Image = _company.Show(); pictureBoxTrain.Image = _company.Show();
@ -100,24 +100,24 @@ namespace ProjectTrain
return; return;
} }
DrawningTrain? plane = null; DrawningTrain? train = null;
int counter = 100; int counter = 100;
while (plane == null) while (train == null)
{ {
plane = _company.GetRandomObject(); train = _company.GetRandomObject();
counter--; counter--;
if (counter <= 0) if (counter <= 0)
{ {
break; break;
} }
} }
if (plane == null) if (train == null)
{ {
return; return;
} }
FormTrain form = new() FormTrain form = new()
{ {
SetTrain = plane SetTrain = train
}; };
form.ShowDialog(); form.ShowDialog();