This commit is contained in:
Макс Бондаренко 2022-11-10 23:29:07 +04:00
parent a41a77ca03
commit f092f6cd87

View File

@ -88,16 +88,20 @@ namespace WarmlyShip
}
private void ButtonAddShip_Click(object sender, EventArgs e)
{
FormShipConfig formShipConfig = new();
formShipConfig.AddEvent(AddShip);
formShipConfig.Show();
}
private void AddShip(DrawingWarmlyShip ship)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
FormClass form = new();
if (form.ShowDialog() == DialogResult.OK)
{
DrawningObjectShip ship = new(form.SelectedShip);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + ship > -1)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectShip(ship) > -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
@ -107,7 +111,6 @@ namespace WarmlyShip
MessageBox.Show("Не удалось добавить объект");
}
}
}
private void ButtonRemoveShip_Click(object sender, EventArgs e)
{