From b741bbced7e04d7894524f1c8125d25d8fb7b640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=91=D0=B0=D1=82=D1=8B?= =?UTF-8?q?=D0=BB=D0=BA=D0=B8=D0=BD=D0=B0?= Date: Mon, 21 Nov 2022 19:56:55 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=205=20=D0=BB=D0=B0=D0=B1=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyShip/WarmlyShip/FormMapWithSetShip.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs b/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs index b519505..5f7f35f 100644 --- a/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs +++ b/WarmlyShip/WarmlyShip/FormMapWithSetShip.cs @@ -84,6 +84,22 @@ namespace WarmlyShip _mapShipCollectionGeneric = null; } } + private void AddShip(DrawningShip ship) + { + if (ListBoxMaps.SelectedIndex == -1) + { + return; + } + if (_mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectShip(ship) != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _mapsCollection[ListBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); + } + } /// /// Добавление объекта /// @@ -92,7 +108,7 @@ namespace WarmlyShip private void ButtonAddShip_Click(object sender, EventArgs e) { var formShipConfig = new FormShipConfig(); - // TODO Call method AddEvent from formCarConfig + formShipConfig.AddEvent(AddShip); formShipConfig.Show(); } ///