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