diff --git a/Airbus/Airbus/FormMapWithSetPlanes.cs b/Airbus/Airbus/FormMapWithSetPlanes.cs index bcc8bac..e372d50 100644 --- a/Airbus/Airbus/FormMapWithSetPlanes.cs +++ b/Airbus/Airbus/FormMapWithSetPlanes.cs @@ -98,38 +98,31 @@ namespace Airbus ReloadMaps(); } } + 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; - } - - /*FormAirbus 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("Не удалось добавить объект"); - } - }*/ } //удаление объекта private void ButtonRemovePlane_Click(object sender, EventArgs e)