From 7b57c35b71bb972dd8494e20b8ef801c4ddfa237 Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Mon, 24 Oct 2022 22:11:35 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=BE=D0=B2=20=D0=B2=20?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B8=D0=BB=D0=B8=D1=89=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Airbus/Airbus/FormMapWithSetPlanes.cs | 47 +++++++++++---------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/Airbus/Airbus/FormMapWithSetPlanes.cs b/Airbus/Airbus/FormMapWithSetPlanes.cs index 69dc45f..84dfb58 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.cs @@ -100,40 +100,31 @@ namespace Airbus } } + private void AddPlane(DrawningAirbus plane) + { + if (listBoxMaps.SelectedIndex == -1) + { + return; + } + if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectPlane(plane) != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); + } + + } + //добавление объекта private void ButtonAddPlane_Click(object sender, EventArgs e) { var formPlaneConfig = new FormPlaneConfig(); - //TODO Call method AvvEvent from formPlaneConfig - + formPlaneConfig.AddEvent(AddPlane); formPlaneConfig.Show(); - - ////////////// ЭТО - /*if(_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null) - { - return; - }*/ - ////////////// - - /*Form1 form = new(); - - if(form.ShowDialog() == DialogResult.OK) - { - DrawningObjectPlane plane = new(form.SelectedPlane);*/ - - /////////////////// И ЭТО В ОТДЕЛЬНЫЙ МЕТОД - /*if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + plane != -1) - { - MessageBox.Show("Объект добавлен"); - pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].ShowSet(); - } - else - { - MessageBox.Show("Не удалось добавить объект"); - }*/ - ////////////////// - //} } //удаление объекта