Этап 3. Форма

This commit is contained in:
Nikolaeva_Y.A 2022-11-22 00:05:09 +04:00
parent 096f04fab5
commit 95a71bd44b
5 changed files with 199 additions and 120 deletions

View File

@ -40,13 +40,18 @@
this.buttonRight = new System.Windows.Forms.Button();
this.buttonUp = new System.Windows.Forms.Button();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
this.buttonDeleteMap = new System.Windows.Forms.Button();
this.buttonAddMap = new System.Windows.Forms.Button();
this.listBoxMaps = new System.Windows.Forms.ListBox();
this.groupBoxTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBoxTools
//
this.groupBoxTools.Controls.Add(this.comboBoxSelectorMap);
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
this.groupBoxTools.Controls.Add(this.buttonAddPlane);
this.groupBoxTools.Controls.Add(this.buttonRemovePlane);
@ -56,10 +61,11 @@
this.groupBoxTools.Controls.Add(this.buttonDown);
this.groupBoxTools.Controls.Add(this.buttonRight);
this.groupBoxTools.Controls.Add(this.buttonUp);
this.groupBoxTools.Controls.Add(this.groupBox1);
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBoxTools.Location = new System.Drawing.Point(600, 0);
this.groupBoxTools.Location = new System.Drawing.Point(627, 0);
this.groupBoxTools.Name = "groupBoxTools";
this.groupBoxTools.Size = new System.Drawing.Size(200, 450);
this.groupBoxTools.Size = new System.Drawing.Size(200, 534);
this.groupBoxTools.TabIndex = 0;
this.groupBoxTools.TabStop = false;
this.groupBoxTools.Text = "Инструменты";
@ -72,7 +78,7 @@
"Простая карта",
"Пустыня",
"Космос"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(21, 31);
this.comboBoxSelectorMap.Location = new System.Drawing.Point(15, 50);
this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(167, 23);
@ -81,14 +87,14 @@
//
// maskedTextBoxPosition
//
this.maskedTextBoxPosition.Location = new System.Drawing.Point(21, 141);
this.maskedTextBoxPosition.Location = new System.Drawing.Point(21, 290);
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
this.maskedTextBoxPosition.Size = new System.Drawing.Size(167, 23);
this.maskedTextBoxPosition.TabIndex = 8;
//
// buttonAddPlane
//
this.buttonAddPlane.Location = new System.Drawing.Point(21, 85);
this.buttonAddPlane.Location = new System.Drawing.Point(21, 248);
this.buttonAddPlane.Name = "buttonAddPlane";
this.buttonAddPlane.Size = new System.Drawing.Size(167, 25);
this.buttonAddPlane.TabIndex = 7;
@ -98,7 +104,7 @@
//
// buttonRemovePlane
//
this.buttonRemovePlane.Location = new System.Drawing.Point(21, 181);
this.buttonRemovePlane.Location = new System.Drawing.Point(21, 331);
this.buttonRemovePlane.Name = "buttonRemovePlane";
this.buttonRemovePlane.Size = new System.Drawing.Size(167, 25);
this.buttonRemovePlane.TabIndex = 6;
@ -108,7 +114,7 @@
//
// buttonShowStorage
//
this.buttonShowStorage.Location = new System.Drawing.Point(21, 239);
this.buttonShowStorage.Location = new System.Drawing.Point(21, 374);
this.buttonShowStorage.Name = "buttonShowStorage";
this.buttonShowStorage.Size = new System.Drawing.Size(167, 25);
this.buttonShowStorage.TabIndex = 5;
@ -118,7 +124,7 @@
//
// buttonShowOnMap
//
this.buttonShowOnMap.Location = new System.Drawing.Point(21, 306);
this.buttonShowOnMap.Location = new System.Drawing.Point(21, 419);
this.buttonShowOnMap.Name = "buttonShowOnMap";
this.buttonShowOnMap.Size = new System.Drawing.Size(167, 25);
this.buttonShowOnMap.TabIndex = 4;
@ -130,7 +136,7 @@
//
this.buttonLeft.BackgroundImage = global::Airbus.Properties.Resources.left;
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonLeft.Location = new System.Drawing.Point(45, 405);
this.buttonLeft.Location = new System.Drawing.Point(43, 489);
this.buttonLeft.Name = "buttonLeft";
this.buttonLeft.Size = new System.Drawing.Size(37, 33);
this.buttonLeft.TabIndex = 3;
@ -141,7 +147,7 @@
//
this.buttonDown.BackgroundImage = global::Airbus.Properties.Resources.down;
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonDown.Location = new System.Drawing.Point(88, 405);
this.buttonDown.Location = new System.Drawing.Point(86, 489);
this.buttonDown.Name = "buttonDown";
this.buttonDown.Size = new System.Drawing.Size(37, 33);
this.buttonDown.TabIndex = 2;
@ -152,7 +158,7 @@
//
this.buttonRight.BackgroundImage = global::Airbus.Properties.Resources.right;
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonRight.Location = new System.Drawing.Point(131, 405);
this.buttonRight.Location = new System.Drawing.Point(129, 489);
this.buttonRight.Name = "buttonRight";
this.buttonRight.Size = new System.Drawing.Size(37, 33);
this.buttonRight.TabIndex = 1;
@ -163,7 +169,7 @@
//
this.buttonUp.BackgroundImage = global::Airbus.Properties.Resources.up;
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.buttonUp.Location = new System.Drawing.Point(88, 366);
this.buttonUp.Location = new System.Drawing.Point(86, 450);
this.buttonUp.Name = "buttonUp";
this.buttonUp.Size = new System.Drawing.Size(37, 33);
this.buttonUp.TabIndex = 0;
@ -175,15 +181,63 @@
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(0, 0);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(600, 450);
this.pictureBox.Size = new System.Drawing.Size(627, 534);
this.pictureBox.TabIndex = 1;
this.pictureBox.TabStop = false;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.listBoxMaps);
this.groupBox1.Controls.Add(this.buttonAddMap);
this.groupBox1.Controls.Add(this.buttonDeleteMap);
this.groupBox1.Controls.Add(this.comboBoxSelectorMap);
this.groupBox1.Controls.Add(this.textBoxNewMapName);
this.groupBox1.Location = new System.Drawing.Point(6, 22);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(188, 220);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Карты";
//
// textBoxNewMapName
//
this.textBoxNewMapName.Location = new System.Drawing.Point(15, 22);
this.textBoxNewMapName.Name = "textBoxNewMapName";
this.textBoxNewMapName.Size = new System.Drawing.Size(167, 23);
this.textBoxNewMapName.TabIndex = 11;
//
// buttonDeleteMap
//
this.buttonDeleteMap.Location = new System.Drawing.Point(15, 191);
this.buttonDeleteMap.Name = "buttonDeleteMap";
this.buttonDeleteMap.Size = new System.Drawing.Size(167, 23);
this.buttonDeleteMap.TabIndex = 12;
this.buttonDeleteMap.Text = "Удалить карту";
this.buttonDeleteMap.UseVisualStyleBackColor = true;
//
// buttonAddMap
//
this.buttonAddMap.Location = new System.Drawing.Point(15, 78);
this.buttonAddMap.Name = "buttonAddMap";
this.buttonAddMap.Size = new System.Drawing.Size(167, 23);
this.buttonAddMap.TabIndex = 13;
this.buttonAddMap.Text = "Добавить карту";
this.buttonAddMap.UseVisualStyleBackColor = true;
//
// listBoxMaps
//
this.listBoxMaps.FormattingEnabled = true;
this.listBoxMaps.ItemHeight = 15;
this.listBoxMaps.Location = new System.Drawing.Point(15, 107);
this.listBoxMaps.Name = "listBoxMaps";
this.listBoxMaps.Size = new System.Drawing.Size(167, 79);
this.listBoxMaps.TabIndex = 14;
//
// FormMapWithSetPlanes
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.ClientSize = new System.Drawing.Size(827, 534);
this.Controls.Add(this.pictureBox);
this.Controls.Add(this.groupBoxTools);
this.Name = "FormMapWithSetPlanes";
@ -191,6 +245,8 @@
this.groupBoxTools.ResumeLayout(false);
this.groupBoxTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
@ -209,5 +265,10 @@
private Button buttonShowStorage;
private Button buttonShowOnMap;
private ComboBox comboBoxSelectorMap;
private GroupBox groupBox1;
private ListBox listBoxMaps;
private Button buttonAddMap;
private Button buttonDeleteMap;
private TextBox textBoxNewMapName;
}
}

View File

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -12,48 +13,93 @@ namespace Airbus
{
public partial class FormMapWithSetPlanes : Form
{
//объект от класса карты с набором объектов
private MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap> _mapPlanesCollectionGeneric;
//словарь для выпадающего списка
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
{
{ "Простая карта", new SimpleMap() },
{ "Пустыны", new DesertMap() },
{ "Космос", new SpaceMap() }
};
//объект от коллекции карт
private readonly MapsCollection _mapsCollection;
public FormMapWithSetPlanes()
{
_mapsCollection = new MapsCollection(pictureBox.Width, pictureBox.Height);
comboBoxSelectorMap.Items.Clear();
foreach (var element in _mapsDict)
{
comboBoxSelectorMap.Items.Add(element.Key);
}
InitializeComponent();
}
//выбор карты
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
//заполнение ListBoxMaps
private void ReloadMaps()
{
AbstractMap map = null;
int index = listBoxMaps.SelectedIndex;
switch (comboBoxSelectorMap.Text)
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >= listBoxMaps.Items.Count))
{
case "Простая карта":
map = new SimpleMap();
break;
case "Пустыня":
map = new DesertMap();
break;
case "Космос":
map = new SpaceMap();
break;
listBoxMaps.SelectedIndex = 0;
}
else if (listBoxMaps.Items.Count > 0 && index > -1 && index < listBoxMaps.Items.Count)
{
listBoxMaps.SelectedIndex = index;
}
}
//добавление карты
private void ButtonAddMap_Click_1(object sender, EventArgs e)
{
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
{
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (map != null)
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
{
_mapPlanesCollectionGeneric = new MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap>(
pictureBox.Width, pictureBox.Height, map);
}
else
{
_mapPlanesCollectionGeneric = null;
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
_mapsCollection.AddMap(textBoxNewMapName.Text,
_mapsDict[comboBoxSelectorMap.Text]);
ReloadMaps();
}
//Выбор карты
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
}
// Удаление карты
private void buttonDeleteMap_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
ReloadMaps();
}
}
//добавление объекта
private void ButtonAddPlane_Click(object sender, EventArgs e)
{
if (_mapPlanesCollectionGeneric == null)
{
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
{
return;
}
@ -64,10 +110,10 @@ namespace Airbus
{
DrawningObjectPlane plane = new(form.SelectedPlane);
if (_mapPlanesCollectionGeneric + plane != -1)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] + plane != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapPlanesCollectionGeneric.ShowSet();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].ShowSet();
}
else
{
@ -91,10 +137,10 @@ namespace Airbus
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_mapPlanesCollectionGeneric - pos != null)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] - pos != null)
{
MessageBox.Show("Объект удалён");
pictureBox.Image = _mapPlanesCollectionGeneric.ShowSet();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].ShowSet();
}
else
{
@ -105,29 +151,29 @@ namespace Airbus
//вывод набора
private void ButtonShowStorage_Click(object sender, EventArgs e)
{
if (_mapPlanesCollectionGeneric == null)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
{
return;
}
pictureBox.Image = _mapPlanesCollectionGeneric.ShowSet();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].ShowSet();
}
//вывод карты
private void ButtonShowOnMap_Click(object sender, EventArgs e)
{
if (_mapPlanesCollectionGeneric == null)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
{
return;
}
pictureBox.Image = _mapPlanesCollectionGeneric.ShowOnMap();
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].ShowOnMap();
}
//перемещение
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_mapPlanesCollectionGeneric == null)
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty] == null)
{
return;
}
@ -152,7 +198,7 @@ namespace Airbus
break;
}
pictureBox.Image = _mapPlanesCollectionGeneric.MoveObject(dir);
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? String.Empty].MoveObject(dir);
}
}

View File

@ -122,36 +122,38 @@ namespace Airbus
Brush asphaltBrush = new SolidBrush(Color.DarkGray);
Brush marcupBrush = new SolidBrush(Color.White);
//заливаем область в цвет бетона
g.FillRectangle(concreteBrush, 0, 0, _pictureWidth, _pictureHeight); //заливаем область в цвет бетона
for (int i = 0; i < _pictureWidth / _placeSizeWidth - 1; i++)
{
//линия разметки места
for (int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j)
{//линия разметки места
g.DrawLine(pen, i * _placeSizeWidth + 5, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight);
{
g.DrawLine(pen, i * _placeSizeWidth - 20, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight);
}
g.DrawLine(pen, i * _placeSizeWidth + 5, _placeSizeHeight * 2, i * _placeSizeWidth + 5, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
g.DrawLine(pen, i * _placeSizeWidth - 20, _placeSizeHeight * 2, i * _placeSizeWidth - 20, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
}
//отрисовка разметки взлётной полосы
g.FillRectangle(marcupBrush, _placeSizeWidth * 2 + 30, 0, 185, _pictureHeight);
g.FillRectangle(asphaltBrush, _placeSizeWidth * 2 + 35, 0, 175, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 2 + 210, 0, _placeSizeWidth * 2 + 210, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 2 + 35, 0, _placeSizeWidth * 2 + 35, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 2 + 215, 0, _placeSizeWidth * 2 + 215, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 2 + 30, 0, _placeSizeWidth * 2 + 30, _pictureHeight);
g.FillRectangle(marcupBrush, _placeSizeWidth * 3 + 10, 0, 185, _pictureHeight);
g.FillRectangle(asphaltBrush, _placeSizeWidth * 3 + 15, 0, 175, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 190, 0, _placeSizeWidth * 3 + 190, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 15, 0, _placeSizeWidth * 3 + 15, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 195, 0, _placeSizeWidth * 3 + 195, _pictureHeight);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 10, 0, _placeSizeWidth * 3 + 10, _pictureHeight);
for (int i = 0; i < _pictureHeight / _placeSizeHeight; ++i)
{
g.DrawLine(marcupPen, _placeSizeWidth * 2 + 125, 20 + i * _placeSizeHeight, _placeSizeWidth * 2 + 125, (i + 1) * _placeSizeHeight - 20);
g.DrawLine(marcupPen, _placeSizeWidth * 3 + 105, 20 + i * _placeSizeHeight, _placeSizeWidth * 3 + 105, (i + 1) * _placeSizeHeight - 20);
}
for (int i = 0; i < _pictureHeight / 20; i++)
{
g.DrawLine(signalFirePen, _placeSizeWidth * 2 + 15, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 2 + 15, (i + 1) * _placeSizeHeight / 2 - 20);
g.DrawLine(signalFirePen, _placeSizeWidth * 3 + 20, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 3 + 20, (i + 1) * _placeSizeHeight / 2 - 20);
g.DrawLine(signalFirePen, _placeSizeWidth * 3 - 5, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 3 - 5, (i + 1) * _placeSizeHeight / 2 - 20);
g.DrawLine(signalFirePen, _placeSizeWidth * 4, 20 + i * _placeSizeHeight / 2, _placeSizeWidth * 4, (i + 1) * _placeSizeHeight / 2 - 20);
}
//отрисовка сочков
@ -180,25 +182,20 @@ namespace Airbus
int width = _pictureWidth / _placeSizeWidth;
int height = _pictureHeight / _placeSizeHeight;
int position = 0;
int index = 0;
int currentWidth = 1;
int currentHeight = 5;
int currentWidth = 2;
int currentHeight = 7;
foreach (var plane in _setPlanes.GetAirbus())
{
plane.SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight);
plane.DrawningObject(g);
index++;
if (position % 2 == 0)
if (currentWidth!= 0)
{
position++;
currentWidth--;
}
else
{
position = 0;
currentWidth = 1;
currentWidth = 2;
currentHeight--;
}
}

View File

@ -32,13 +32,15 @@ namespace Airbus
//добавление карты
public void AddMap(string name, AbstractMap map)
{
//ТОDO прописать логику для добавления
var NewElem = new MapWithSetPlanesGeneric<DrawningObjectPlane, AbstractMap>(
_pictureWidth, _pictureHeight, map);
_mapStorage.Add(name, NewElem);
}
//удаление карты
public void DelMap(string name)
{
//ТОDO прописать логику для удаления
_mapStorage.Remove(name);
}
//Доступ к аэродрому
@ -46,8 +48,7 @@ namespace Airbus
{
get
{
//TODO продумать логику получения объекта
return null;
return _mapStorage[ind];
}
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Text;
using System.Threading.Tasks;
@ -28,69 +29,40 @@ namespace Airbus
//добавление объекта в набор
public int Insert(T plane)
{
//вставка в начало набора
//проверка на максим. кол-во//
return Insert(plane, 0);
if (Count + 1 <= _maxCount) return Insert(plane, 0);
else return -1;
}
//добавление объекта в набор на конкретную позицию
public int Insert(T plane, int position)
{
// проверка позиции
if (position >= _places.Count || position < 0)
if (position >= _maxCount && position < 0)
{
return -1;
}
//проверка, что элемент массива по этой позиции пустой, если нет, то
if (_places[position] == null)
{
_places[position] = plane;
return position;
}
//проверка, что после вставляемого элемента в массиве есть пустой элемент
int findEmptyPos = -1;
for (int i = position + 1; i < Count; i++)
{
if (_places[i] == null)
{
findEmptyPos = i;
break;
}
}
if (findEmptyPos < 0)
{
return -1;
}
//сдвиг всех объектов, находящихся справа от позиции до первого пустого элемента
for (int i = findEmptyPos; i > position; i--)
{
_places[i] = _places[i - 1];
}
// вставка по позиции
_places[position] = plane;
_places.Insert(position, plane);
return position;
}
//удаление объекта из набора с конкретной позиции
public T Remove(int position)
{
// проверка позиции
if (position >= _places.Count || position < 0)
if (position < _maxCount && position >= 0)
{
if (_places.ElementAt(position) != null)
{
T result = _places.ElementAt(position);
_places.RemoveAt(position);
return result;
}
return null;
}
// удаление объекта из массива, присовив элементу массива значение null
T temp = _places[position];
_places[position] = null;
return temp;
return null;
}
//получение объекта из набора по позиции
@ -111,8 +83,10 @@ namespace Airbus
}
set
{
//TODO проверка позиции
//TODO вставка в список по позиции
if (position < _maxCount && position >= 0)
{
Insert(this[position], position);
}
}
}