From 1a47187541b3b4a4fa4722a8d569340eb54dba61 Mon Sep 17 00:00:00 2001 From: RomanovEgor Date: Sun, 25 Dec 2022 10:42:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'HoistingCrane/HoistingCrane/FormMapWi?= =?UTF-8?q?thSetHoistingCrane.cs'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RomanovEgor --- .../FormMapWithSetHoistingCrane.cs | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs index 8784862..e458376 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs @@ -30,7 +30,10 @@ namespace HoistingCrane break; case "Вторая карта": map = new SecondMap(); - break; + break; + + + } if (map != null) { @@ -47,24 +50,26 @@ namespace HoistingCrane { if (_mapHoistingCraneCollectionGeneric == null) { - return; - } - FormHoistingCrane form = new(); - if (form.ShowDialog() == DialogResult.OK) + var formHoistingCraneConfig = new FormHoistingCraneConfig(); + formHoistingCraneConfig.AddEvent(AddHoistingCrane); + formHoistingCraneConfig.Show(); + } + private void AddHoistingCrane(DrawingHoistingCrane drawingHoistingCrane) + { + DrawingObjectHoistingCrane hoistingCrane = new DrawingObjectHoistingCrane(drawingHoistingCrane); + if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + hoistingCrane != -1) { - DrawingObjectHoistingCrane hoistingCrane = new(form.SelectedHoistingCrane); - if (_mapHoistingCraneCollectionGeneric + hoistingCrane == 1) - { - MessageBox.Show("Объект добавлен"); - pictureBox.Image = _mapHoistingCraneCollectionGeneric.ShowSet(); - } - else - { - MessageBox.Show("Не удалось добавить объект"); - } + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); } } - + } + } + } private void ButtonRemoveHoistingCrane_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))