From 4e2fbc8e7a1799563bda9835b9304bff0d5dd866 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 | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs index 8784862..39dbbe1 100644 --- a/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs +++ b/HoistingCrane/HoistingCrane/FormMapWithSetHoistingCrane.cs @@ -31,6 +31,7 @@ namespace HoistingCrane case "Вторая карта": map = new SecondMap(); break; + } if (map != null) { @@ -49,22 +50,24 @@ namespace HoistingCrane { 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))