Исправление

This commit is contained in:
Сергей Полевой 2022-10-25 01:57:21 +04:00
parent 82904c3f20
commit 3cee8a2eab
2 changed files with 6 additions and 2 deletions

View File

@ -118,6 +118,5 @@ namespace Artilleries
EventAddArtillery?.Invoke(_artillery); EventAddArtillery?.Invoke(_artillery);
Close(); Close();
} }
} }
} }

View File

@ -89,7 +89,12 @@ namespace Artilleries
private void buttonAddArtillery_Click(object sender, EventArgs e) private void buttonAddArtillery_Click(object sender, EventArgs e)
{ {
var formArtilleryConfig = new FormArtilleryConfig(); var formArtilleryConfig = new FormArtilleryConfig();
formArtilleryConfig.AddEvent((artillery) => { formArtilleryConfig.AddEvent((artillery) => {
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + new DrawingObjectArtillery(artillery) != -1) if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + new DrawingObjectArtillery(artillery) != -1)
{ {
MessageBox.Show("Объект добавлен"); MessageBox.Show("Объект добавлен");