Compare commits

..

No commits in common. "2fd3db0774756b8d15c1a2dff92f1bfb04b4d000" and "36a5f9721d419dd91c98d107f61b9ab6ede8e2b2" have entirely different histories.

2 changed files with 11 additions and 30 deletions

View File

@ -1,5 +1,4 @@
using ProjectTrain.Drawnings;
using ProjectTrain.CollectionGenericObjects;
namespace ProjectTrain.CollectionGenericObjects
{
@ -15,23 +14,7 @@ namespace ProjectTrain.CollectionGenericObjects
/// </summary>
private T?[] _collection;
public int Count => _collection.Length;
public int SetMaxCount
{
set
{
if (value > 0)
{
if (_collection.Length > 0)
{
Array.Resize(ref _collection, value);
}
else
{
_collection = new T?[value];
}
}
}
}
public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } }
/// <summary>
/// Конструктор
@ -44,10 +27,11 @@ namespace ProjectTrain.CollectionGenericObjects
{
// TODO проверка позиции
if (position >= _collection.Length || position < 0)
{ return null; }
{
return null;
}
return _collection[position];
}
public int Insert(T obj)
{
// TODO вставка в свободное место набора
@ -59,12 +43,10 @@ namespace ProjectTrain.CollectionGenericObjects
_collection[index] = obj;
return index;
}
index++;
}
return -1;
}
public int Insert(T obj, int position)
{
// TODO проверка позиции
@ -101,16 +83,15 @@ namespace ProjectTrain.CollectionGenericObjects
}
return -1;
}
public T Remove(int position)
{
// TODO проверка позиции
// TODO удаление объекта из массива, присвоив элементу массива значение null
if (position >= _collection.Length || position < 0)
{ return null; }
T obj = _collection[position];
T drawningTrain = _collection[position];
_collection[position] = null;
return obj;
return drawningTrain;
}
}
}

View File

@ -60,7 +60,7 @@
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Controls.Add(panelCompanyTools);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(558, 0);
groupBoxTools.Location = new Point(510, 0);
groupBoxTools.Margin = new Padding(3, 2, 3, 2);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Padding = new Padding(3, 2, 3, 2);
@ -273,7 +273,7 @@
pictureBoxTrain.Location = new Point(0, 0);
pictureBoxTrain.Margin = new Padding(3, 2, 3, 2);
pictureBoxTrain.Name = "pictureBoxTrain";
pictureBoxTrain.Size = new Size(558, 490);
pictureBoxTrain.Size = new Size(510, 490);
pictureBoxTrain.TabIndex = 1;
pictureBoxTrain.TabStop = false;
//
@ -281,7 +281,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(752, 490);
ClientSize = new Size(704, 490);
Controls.Add(pictureBoxTrain);
Controls.Add(groupBoxTools);
Margin = new Padding(3, 2, 3, 2);