Pibd-13 Kadyshev_M.I. LabWork04 Base #4

Closed
nezui wants to merge 3 commits from LabWork04 into LabWork03
4 changed files with 33 additions and 3 deletions
Showing only changes of commit 6dcc2b89b7 - Show all commits

View File

@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace ProjectAirFighter.CollectionGenericObjects;
/// <summary>
/// Перечисление типов коллекции
/// </summary>
public enum CollectionType
{
/// <summary>

View File

@ -17,11 +17,26 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
/// <summary>
/// Массив объектов, которые хроним
/// </summary>
private T[] _collection;
private T?[] _collection;
public int Count => _collection.Length;
public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } }
public int SetMaxCount
{
set
{
if (value > 0)
{
if (Count > 0)
{
Array.Resize(ref _collection, value);
}
else {
_collection = new T?[value];
}
}
}
}
/// <summary>
/// Конструктор

View File

@ -81,4 +81,16 @@ public class StorageCollection<T>
return _storages[name];
}
}
public ICollectionGenericObjects<T>? this[int index]
{
get
{
//логика получения объекта
if (index > Keys.Count || index < 0)
return null;
return _storages[Keys[index]];
}
}
}

View File

@ -215,7 +215,7 @@ public partial class FormWarPlaneCollection : Form
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
{
return;
}