Петрушин Егор ПИбд-22 Лабораторная работа №4 "Самоходная артиллерийская установка" #9
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user