From c692d3f3e62babca4a358df8c07feba78e3b148a Mon Sep 17 00:00:00 2001 From: Baryshev Dmitry Date: Fri, 5 Apr 2024 14:56:20 +0400 Subject: [PATCH] . --- .../ProjectDumpTruck/FormTruckCollection.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ProjectDumpTruck/ProjectDumpTruck/FormTruckCollection.cs b/ProjectDumpTruck/ProjectDumpTruck/FormTruckCollection.cs index 2e72446..c20919b 100644 --- a/ProjectDumpTruck/ProjectDumpTruck/FormTruckCollection.cs +++ b/ProjectDumpTruck/ProjectDumpTruck/FormTruckCollection.cs @@ -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("Не удалось добавить объект"); } } - /// /// Получение цвета /// @@ -98,7 +95,6 @@ public partial class FormTruckCollection : Form { color = dialog.Color; } - return color; }