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