лаб-5
This commit is contained in:
parent
9ae7b9a2eb
commit
262f64521c
@ -116,28 +116,29 @@ pictureBox.Height);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ButtonAddAircraftCarrier_Click(object sender, EventArgs e)
|
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)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormAircraftCarrier form = new();
|
DrawningObjectAircraftCarrier aircraftcarrier = new(drawningAircraftCarrier);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
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("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox.Image =
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
private void buttonRemoveAircraftCarrier_Click(object sender, EventArgs e)
|
private void buttonRemoveAircraftCarrier_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
@ -164,6 +165,7 @@ string.Empty] - pos != null)
|
|||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось удалить объект");
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void buttonShowStorage_Click(object sender, EventArgs e)
|
private void buttonShowStorage_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -179,6 +181,7 @@ string.Empty] - pos != null)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pictureBox.Image = _mapAircraftCarriersCollectionGeneric.ShowOnMap();
|
pictureBox.Image = _mapAircraftCarriersCollectionGeneric.ShowOnMap();
|
||||||
}
|
}
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
@ -72,5 +72,21 @@ namespace AircraftCarrier
|
|||||||
return mapWithSetAircraftCarriersGeneric;
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user