From 00ab8a92f265b14568f852216f961ae81e2e1ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?10=D0=93=20=D0=95=D0=B3=D0=BE=D1=80=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Mon, 10 Oct 2022 19:53:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D1=80=D0=B5=D1=82=D1=8C=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormMapWithSetHoistingCrane.cs | 23 ++++++++++--------- .../MapWithSetHoistingCraneGeneric.cs | 3 ++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs index 9276ad4..05cd7a1 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs @@ -35,7 +35,9 @@ namespace HoistingCrane private MapWithSetHoistingCraneGeneric _mapHoistingCraneCollectionGeneric; + public FormMapWithSetHoistingCrane() { + InitializeComponent(); } private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e) @@ -43,6 +45,7 @@ namespace HoistingCrane AbstractMap map = null; switch (comboBoxSelectorMap.Text) { + case "Первая карта": map = new SimpleMap(); break; case "Вторая карта": @@ -86,25 +89,21 @@ namespace HoistingCrane pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); _logger.LogInformation($"Переход на карту {listBoxMaps.SelectedItem?.ToString()}"); } - /// - /// Удаление карты - /// - /// - /// - private void buttonDeleteMap_Click(object sender, EventArgs e) - { - if (listBoxMaps.SelectedIndex == -1) - { - return; - } + private void ButtonAddHoistingCrane_Click(object sender, EventArgs e) { if (_mapHoistingCraneCollectionGeneric == null) { + return; } + FormHoistingCrane form = new(); + if (form.ShowDialog() == DialogResult.OK) { + DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane); + if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1) { MessageBox.Show("Объект добавлен"); + pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet(); } else { @@ -112,6 +111,7 @@ namespace HoistingCrane } } } + private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(maskedTextBoxPosition.Text)) @@ -175,6 +175,7 @@ namespace HoistingCrane enums = Direction.Right; break; } + pictureBox.Image = _mapHoistingCraneCollectionGeneric.MoveObject(enums); } private void pictureBox_Click(object sender, EventArgs e) diff --git a/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs b/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs index 6704aac..5ab5352 100644 --- a/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs +++ b/HoistingCrane/HoistingCrane/MapWithSetHoistingCraneGeneric.cs @@ -42,7 +42,7 @@ namespace HoistingCrane Bitmap bmp = new(_pictureWidth, _pictureWidth); Graphics gr = Graphics.FromImage(bmp); DrawBackground(gr); - DrawHoistingCranes(gr); + DrawBulldozers(gr); return bmp; } @@ -107,6 +107,7 @@ namespace HoistingCrane } } + private void DrawBulldozers(Graphics gr) { int heightEl = _pictureHeight / _placeSizeHeight; int widthEl = _pictureWidth / _placeSizeWidth;