Небольшие изменения.
This commit is contained in:
parent
c9b0d52c9f
commit
1f66a0689b
@ -132,7 +132,6 @@ namespace ElectricLocomotive
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(151, 23);
|
||||
comboBoxStrategy.TabIndex = 6;
|
||||
comboBoxStrategy.SelectedIndexChanged += comboBoxStrategy_SelectedIndexChanged;
|
||||
//
|
||||
// buttonCreateLocomotive
|
||||
//
|
||||
@ -189,7 +188,6 @@ namespace ElectricLocomotive
|
||||
Name = "FormElectricLocomotive";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "ElectricLocomotive";
|
||||
Load += ElectricLocomotive_Load;
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxElectricLocomotive).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
|
@ -123,17 +123,6 @@ namespace ElectricLocomotive
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
private void comboBoxStrategy_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void pictureBoxElectricLocomotive_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void ElectricLocomotive_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
private void ButtonSelectLocomotive_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedLocomotive = _drawingLocomotive;
|
||||
|
@ -54,7 +54,6 @@
|
||||
panelLocomotiveCollection.Size = new Size(208, 448);
|
||||
panelLocomotiveCollection.TabIndex = 0;
|
||||
panelLocomotiveCollection.Tag = "Инструменты";
|
||||
panelLocomotiveCollection.Paint += panelLocomotiveCollection_Paint;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
@ -109,7 +108,6 @@
|
||||
LabelOnPanel.Size = new Size(83, 15);
|
||||
LabelOnPanel.TabIndex = 4;
|
||||
LabelOnPanel.Text = "Инструменты";
|
||||
LabelOnPanel.Click += LabelOnPanel_Click;
|
||||
//
|
||||
// FormLocomotiveCollection
|
||||
//
|
||||
@ -120,13 +118,11 @@
|
||||
Controls.Add(panelLocomotiveCollection);
|
||||
Name = "FormLocomotiveCollection";
|
||||
Text = "Набор локомотивов";
|
||||
Load += FormLocomotiveCollection_Load;
|
||||
panelLocomotiveCollection.ResumeLayout(false);
|
||||
panelLocomotiveCollection.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panelLocomotiveCollection;
|
||||
|
@ -60,16 +60,5 @@ namespace ProjectElectricLocomotive
|
||||
{
|
||||
pictureBoxCollection.Image = _locomotives.ShowLocomotives();
|
||||
}
|
||||
private void FormLocomotiveCollection_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
private void LabelOnPanel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void panelLocomotiveCollection_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,45 +17,45 @@ namespace ProjectElectricLocomotive.Generics
|
||||
_maxCount = count;
|
||||
_places = new List<T?>(count);
|
||||
}
|
||||
public bool Insert(T locomotive)
|
||||
public int Insert(T locomotive)
|
||||
{
|
||||
// TODO вставка в начало набора
|
||||
return true;
|
||||
return Insert(locomotive, 0);
|
||||
}
|
||||
public bool Insert(T locomotive, int position)
|
||||
public int Insert(T locomotive, int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO проверка, что есть место для вставки
|
||||
// TODO вставка по позиции
|
||||
_places[position] = locomotive;
|
||||
return true;
|
||||
if (position < 0 || position >= _maxCount) return -1;
|
||||
_places.Insert(position, locomotive);
|
||||
return position;
|
||||
}
|
||||
public bool Remove(int position)
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO удаление объекта из списка
|
||||
return true;
|
||||
if (position >= Count || position < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
T? tmp = _places[position];
|
||||
_places[position] = null;
|
||||
return tmp;
|
||||
}
|
||||
public T? this[int position]
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO проверка позиции
|
||||
if (position < 0 || position >= Count) return null;
|
||||
return _places[position];
|
||||
}
|
||||
set
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO проверка свободных мест в списке
|
||||
// TODO вставка в список по позиции
|
||||
if (position < 0 || position >= Count || Count == _maxCount) return;
|
||||
_places.Insert(position, value);
|
||||
}
|
||||
}
|
||||
public IEnumerable<T?> GetLocos(int? maxLocos = null)
|
||||
public IEnumerable<T?> GetLocomotives(int? maxLocomotives = null)
|
||||
{
|
||||
for (int i = 0; i < _places.Count; ++i)
|
||||
{
|
||||
yield return _places[i];
|
||||
if (maxLocos.HasValue && i == maxLocos.Value)
|
||||
if (maxLocomotives.HasValue && i == maxLocomotives.Value)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user