Event
This commit is contained in:
parent
a41a77ca03
commit
f092f6cd87
@ -88,24 +88,27 @@ namespace WarmlyShip
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonAddShip_Click(object sender, EventArgs e)
|
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)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormClass form = new();
|
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectShip(ship) > -1)
|
||||||
{
|
{
|
||||||
DrawningObjectShip ship = new(form.SelectedShip);
|
MessageBox.Show("Объект добавлен");
|
||||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + ship > -1)
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
{
|
}
|
||||||
MessageBox.Show("Объект добавлен");
|
else
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
{
|
||||||
}
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user