This commit is contained in:
Daniya_Youdakova 2022-12-24 21:57:58 +04:00
parent 9ae7b9a2eb
commit 262f64521c
2 changed files with 33 additions and 14 deletions

View File

@ -116,26 +116,27 @@ pictureBox.Height);
}
}
private void ButtonAddAircraftCarrier_Click(object sender, EventArgs e)
{
var formAircraftCarrierConfig = new FormAircraftCarrierConfig();
// TODO Call method AddEvent from formCarConfig
formAircraftCarrierConfig.AddEvent(AddAircraftCarrier);
formAircraftCarrierConfig.Show();
}
private void AddAircraftCarrier(DrawningAircraftCarrier drawningAircraftCarrier)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
FormAircraftCarrier form = new();
if (form.ShowDialog() == DialogResult.OK)
DrawningObjectAircraftCarrier aircraftcarrier = new(drawningAircraftCarrier);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + aircraftcarrier != -1)
{
DrawningObjectAircraftCarrier aircraftcarrier = new(form.SelectedAircraftCarrier);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ??
string.Empty] + aircraftcarrier != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image =
_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void buttonRemoveAircraftCarrier_Click(object sender, EventArgs e)
@ -164,6 +165,7 @@ string.Empty] - pos != null)
{
MessageBox.Show("Не удалось удалить объект");
}
}
private void buttonShowStorage_Click(object sender, EventArgs e)
{
@ -179,6 +181,7 @@ string.Empty] - pos != null)
{
return;
}
pictureBox.Image = _mapAircraftCarriersCollectionGeneric.ShowOnMap();
}
private void ButtonMove_Click(object sender, EventArgs e)

View File

@ -72,5 +72,21 @@ namespace AircraftCarrier
return mapWithSetAircraftCarriersGeneric;
}
}
public MapWithSetAircraftCarriersGeneric<DrawningObjectAircraftCarrier, AbstractMap> this[int index]
{
get
{
if ((index < 0) || (index >= Keys.Count))
{
return null;
}
else
{
string StringKey = Keys[index];
return _mapStorages[StringKey];
}
}
}
}
}