Youdakova D.R. PIbd-21 LabWork05 #5

Closed
Daniya_Youdakova wants to merge 5 commits from LabWork05 into LabWork04
2 changed files with 33 additions and 14 deletions
Showing only changes of commit 262f64521c - Show all commits

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];
}
}
}
}
}