Третий шаг (почти)

This commit is contained in:
GokaPek 2023-10-25 08:46:18 +04:00
parent 6f6ac06475
commit f1924cb952
2 changed files with 2 additions and 12 deletions

View File

@ -78,8 +78,7 @@ namespace SelfPropelledArtilleryUnit
/// <param name="e"></param>
private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBoxCollection.Image =
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowSPAUs();
pictureBoxCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowSPAUs();
}
private void ButtonDelObject_Click(object sender, EventArgs e)

View File

@ -61,20 +61,11 @@ namespace SelfPropelledArtilleryUnit.Generics
if (position >= _maxCount)
return -1;
int nullIndex = _places.IndexOf(null);
if (Count == 0)
{
_places.Add(spau);
}
else if (nullIndex != -1)
{
for (int i = nullIndex; i > 0; i--)
{
_places[i] = _places[i - 1];
}
_places[position] = spau;
}
else
{
_places.Insert(position, spau);
@ -91,7 +82,7 @@ namespace SelfPropelledArtilleryUnit.Generics
if (position < 0 || position >= Count)
return false;
_places[position] = null;
_places.RemoveAt(position);
return true;
}