This commit is contained in:
nikbel2004@outlook.com 2023-12-09 02:47:52 +04:00
parent a3f01ebd0f
commit 0630250103
2 changed files with 3 additions and 4 deletions

View File

@ -64,8 +64,7 @@ namespace Tank
_logger.LogInformation($"Добавлен набор: {SetTextBox.Text}");
}
private void ListBoxObjects_SelectedIndexChanged(object sender,
EventArgs e)
private void ListBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
{
DrawTank.Image =
_storage[CollectionListBox.SelectedItem?.ToString() ?? string.Empty]?.ShowTanks();

View File

@ -34,10 +34,10 @@ namespace Tank
public bool Insert(T tank, int position)
{
if (position < 0 || position >= _maxCount)
throw new TankNotFoundException(position);
throw new TankNotFoundException(position); // По позиции
if (Count >= _maxCount)
throw new TankStorageOverflowException(_maxCount); // Макс количество или позицию
throw new TankStorageOverflowException(_maxCount); // Макс количество в коллекции
_places.Insert(0, tank);
return true;
}