This commit is contained in:
Baryshev Dmitry 2024-04-05 14:56:20 +04:00
parent e93d2f1254
commit c692d3f3e6

View File

@ -57,24 +57,22 @@ public partial class FormTruckCollection : Form
{
return;
}
Random random = new();
DrawningTruck drawningWarship;
DrawningTruck drawningTruck;
switch (type)
{
case nameof(DrawningTruck):
drawningWarship = new DrawningTruck(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
drawningTruck = new DrawningTruck(random.Next(100, 300),
random.Next(1000, 3000), GetColor(random));
break;
case nameof(DrawningDumpTruck):
// TODO вызов диалогового окна для выбора цвета
drawningWarship = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000), GetColor(random), GetColor(random),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
GetColor(random), GetColor(random),Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
if (_company + drawningWarship != -1)
if (_company + drawningTruck != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
@ -84,7 +82,6 @@ public partial class FormTruckCollection : Form
MessageBox.Show("Не удалось добавить объект");
}
}
/// <summary>
/// Получение цвета
/// </summary>
@ -98,7 +95,6 @@ public partial class FormTruckCollection : Form
{
color = dialog.Color;
}
return color;
}