mb redy lab 8
This commit is contained in:
parent
ae63529594
commit
0afbadbc68
@ -42,6 +42,8 @@
|
|||||||
ButtonAddObject = new Button();
|
ButtonAddObject = new Button();
|
||||||
ButtonRemoveObject = new Button();
|
ButtonRemoveObject = new Button();
|
||||||
Instruments = new GroupBox();
|
Instruments = new GroupBox();
|
||||||
|
buttonSortByType = new Button();
|
||||||
|
buttonSortByColor = new Button();
|
||||||
menuStrip1 = new MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
файлToolStripMenuItem = new ToolStripMenuItem();
|
файлToolStripMenuItem = new ToolStripMenuItem();
|
||||||
SaveToolStripMenuItem = new ToolStripMenuItem();
|
SaveToolStripMenuItem = new ToolStripMenuItem();
|
||||||
@ -59,17 +61,18 @@
|
|||||||
// maskedTextBoxNumber
|
// maskedTextBoxNumber
|
||||||
//
|
//
|
||||||
maskedTextBoxNumber.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
maskedTextBoxNumber.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
maskedTextBoxNumber.Location = new Point(38, 342);
|
maskedTextBoxNumber.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
maskedTextBoxNumber.Location = new Point(38, 417);
|
||||||
maskedTextBoxNumber.Mask = "00";
|
maskedTextBoxNumber.Mask = "00";
|
||||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||||
maskedTextBoxNumber.Size = new Size(156, 27);
|
maskedTextBoxNumber.Size = new Size(156, 26);
|
||||||
maskedTextBoxNumber.TabIndex = 4;
|
maskedTextBoxNumber.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// ButtonRefreshCollection
|
// ButtonRefreshCollection
|
||||||
//
|
//
|
||||||
ButtonRefreshCollection.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
ButtonRefreshCollection.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
ButtonRefreshCollection.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
ButtonRefreshCollection.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
ButtonRefreshCollection.Location = new Point(38, 412);
|
ButtonRefreshCollection.Location = new Point(38, 518);
|
||||||
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||||
ButtonRefreshCollection.Size = new Size(150, 29);
|
ButtonRefreshCollection.Size = new Size(150, 29);
|
||||||
ButtonRefreshCollection.TabIndex = 2;
|
ButtonRefreshCollection.TabIndex = 2;
|
||||||
@ -80,7 +83,7 @@
|
|||||||
//
|
//
|
||||||
ButtonRemoveLocomotive.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
ButtonRemoveLocomotive.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
ButtonRemoveLocomotive.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
ButtonRemoveLocomotive.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
ButtonRemoveLocomotive.Location = new Point(37, 375);
|
ButtonRemoveLocomotive.Location = new Point(38, 481);
|
||||||
ButtonRemoveLocomotive.Name = "ButtonRemoveLocomotive";
|
ButtonRemoveLocomotive.Name = "ButtonRemoveLocomotive";
|
||||||
ButtonRemoveLocomotive.Size = new Size(150, 31);
|
ButtonRemoveLocomotive.Size = new Size(150, 31);
|
||||||
ButtonRemoveLocomotive.TabIndex = 1;
|
ButtonRemoveLocomotive.TabIndex = 1;
|
||||||
@ -92,7 +95,7 @@
|
|||||||
//
|
//
|
||||||
ButtonAddLocomotive.Anchor = AnchorStyles.Top;
|
ButtonAddLocomotive.Anchor = AnchorStyles.Top;
|
||||||
ButtonAddLocomotive.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
ButtonAddLocomotive.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
ButtonAddLocomotive.Location = new Point(38, 306);
|
ButtonAddLocomotive.Location = new Point(38, 381);
|
||||||
ButtonAddLocomotive.Name = "ButtonAddLocomotive";
|
ButtonAddLocomotive.Name = "ButtonAddLocomotive";
|
||||||
ButtonAddLocomotive.Size = new Size(150, 30);
|
ButtonAddLocomotive.Size = new Size(150, 30);
|
||||||
ButtonAddLocomotive.TabIndex = 0;
|
ButtonAddLocomotive.TabIndex = 0;
|
||||||
@ -103,32 +106,30 @@
|
|||||||
// pictureBoxCollections
|
// pictureBoxCollections
|
||||||
//
|
//
|
||||||
pictureBoxCollections.Anchor = AnchorStyles.Left;
|
pictureBoxCollections.Anchor = AnchorStyles.Left;
|
||||||
pictureBoxCollections.Location = new Point(-1, 31);
|
pictureBoxCollections.Location = new Point(0, 31);
|
||||||
pictureBoxCollections.Name = "pictureBoxCollections";
|
pictureBoxCollections.Name = "pictureBoxCollections";
|
||||||
pictureBoxCollections.Size = new Size(303, 409);
|
pictureBoxCollections.Size = new Size(303, 523);
|
||||||
pictureBoxCollections.TabIndex = 1;
|
pictureBoxCollections.TabIndex = 1;
|
||||||
pictureBoxCollections.TabStop = false;
|
pictureBoxCollections.TabStop = false;
|
||||||
//
|
//
|
||||||
// textBoxStorageName
|
// textBoxStorageName
|
||||||
//
|
//
|
||||||
textBoxStorageName.Location = new Point(31, 28);
|
textBoxStorageName.Location = new Point(31, 28);
|
||||||
textBoxStorageName.Margin = new Padding(3, 4, 3, 4);
|
|
||||||
textBoxStorageName.Name = "textBoxStorageName";
|
textBoxStorageName.Name = "textBoxStorageName";
|
||||||
textBoxStorageName.Size = new Size(149, 27);
|
textBoxStorageName.Size = new Size(149, 27);
|
||||||
textBoxStorageName.TabIndex = 5;
|
textBoxStorageName.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
groupBox1.Anchor = AnchorStyles.None;
|
|
||||||
groupBox1.Controls.Add(listBoxStorage);
|
groupBox1.Controls.Add(listBoxStorage);
|
||||||
groupBox1.Controls.Add(ButtonAddObject);
|
groupBox1.Controls.Add(ButtonAddObject);
|
||||||
groupBox1.Controls.Add(ButtonRemoveObject);
|
groupBox1.Controls.Add(ButtonRemoveObject);
|
||||||
groupBox1.Controls.Add(textBoxStorageName);
|
groupBox1.Controls.Add(textBoxStorageName);
|
||||||
groupBox1.Location = new Point(7, 29);
|
groupBox1.Location = new Point(7, 18);
|
||||||
groupBox1.Margin = new Padding(3, 4, 3, 4);
|
//groupBox1.Margin = new Padding(3, 4, 3, 4);
|
||||||
groupBox1.Name = "groupBox1";
|
groupBox1.Name = "groupBox1";
|
||||||
groupBox1.Padding = new Padding(3, 4, 3, 4);
|
//groupBox1.Padding = new Padding(3, 4, 3, 4);
|
||||||
groupBox1.Size = new Size(216, 270);
|
groupBox1.Size = new Size(216, 280);
|
||||||
groupBox1.TabIndex = 5;
|
groupBox1.TabIndex = 5;
|
||||||
groupBox1.TabStop = false;
|
groupBox1.TabStop = false;
|
||||||
groupBox1.Text = "Наборы";
|
groupBox1.Text = "Наборы";
|
||||||
@ -160,7 +161,7 @@
|
|||||||
//
|
//
|
||||||
ButtonRemoveObject.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
ButtonRemoveObject.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
ButtonRemoveObject.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
ButtonRemoveObject.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
ButtonRemoveObject.Location = new Point(31, 228);
|
ButtonRemoveObject.Location = new Point(31, 238);
|
||||||
ButtonRemoveObject.Name = "ButtonRemoveObject";
|
ButtonRemoveObject.Name = "ButtonRemoveObject";
|
||||||
ButtonRemoveObject.Size = new Size(149, 31);
|
ButtonRemoveObject.Size = new Size(149, 31);
|
||||||
ButtonRemoveObject.TabIndex = 8;
|
ButtonRemoveObject.TabIndex = 8;
|
||||||
@ -171,20 +172,46 @@
|
|||||||
// Instruments
|
// Instruments
|
||||||
//
|
//
|
||||||
Instruments.Anchor = AnchorStyles.Right;
|
Instruments.Anchor = AnchorStyles.Right;
|
||||||
|
Instruments.Controls.Add(buttonSortByType);
|
||||||
|
Instruments.Controls.Add(buttonSortByColor);
|
||||||
Instruments.Controls.Add(ButtonRefreshCollection);
|
Instruments.Controls.Add(ButtonRefreshCollection);
|
||||||
Instruments.Controls.Add(groupBox1);
|
Instruments.Controls.Add(groupBox1);
|
||||||
Instruments.Controls.Add(maskedTextBoxNumber);
|
Instruments.Controls.Add(maskedTextBoxNumber);
|
||||||
Instruments.Controls.Add(ButtonAddLocomotive);
|
Instruments.Controls.Add(ButtonAddLocomotive);
|
||||||
Instruments.Controls.Add(ButtonRemoveLocomotive);
|
Instruments.Controls.Add(ButtonRemoveLocomotive);
|
||||||
Instruments.Location = new Point(302, -1);
|
Instruments.Location = new Point(302, 0);
|
||||||
Instruments.Margin = new Padding(3, 4, 3, 4);
|
Instruments.Margin = new Padding(3, 4, 3, 4);
|
||||||
Instruments.Name = "Instruments";
|
Instruments.Name = "Instruments";
|
||||||
Instruments.Padding = new Padding(3, 4, 3, 4);
|
Instruments.Padding = new Padding(3, 4, 3, 4);
|
||||||
Instruments.Size = new Size(236, 448);
|
Instruments.Size = new Size(236, 554);
|
||||||
Instruments.TabIndex = 6;
|
Instruments.TabIndex = 6;
|
||||||
Instruments.TabStop = false;
|
Instruments.TabStop = false;
|
||||||
Instruments.Text = "Инструменты";
|
Instruments.Text = "Инструменты";
|
||||||
//
|
//
|
||||||
|
// buttonSortByType
|
||||||
|
//
|
||||||
|
buttonSortByType.Anchor = AnchorStyles.Top;
|
||||||
|
buttonSortByType.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
buttonSortByType.Location = new Point(44, 305);
|
||||||
|
buttonSortByType.Name = "buttonSortByType";
|
||||||
|
buttonSortByType.Size = new Size(150, 30);
|
||||||
|
buttonSortByType.TabIndex = 7;
|
||||||
|
buttonSortByType.Text = "Сортировать по типу";
|
||||||
|
buttonSortByType.UseVisualStyleBackColor = true;
|
||||||
|
buttonSortByType.Click += buttonSortByType_Click;
|
||||||
|
//
|
||||||
|
// buttonSortByColor
|
||||||
|
//
|
||||||
|
buttonSortByColor.Anchor = AnchorStyles.Top;
|
||||||
|
buttonSortByColor.Font = new Font("Candara Light", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
||||||
|
buttonSortByColor.Location = new Point(25, 341);
|
||||||
|
buttonSortByColor.Name = "buttonSortByColor";
|
||||||
|
buttonSortByColor.Size = new Size(181, 30);
|
||||||
|
buttonSortByColor.TabIndex = 6;
|
||||||
|
buttonSortByColor.Text = "Сортировать по цвету";
|
||||||
|
buttonSortByColor.UseVisualStyleBackColor = true;
|
||||||
|
buttonSortByColor.Click += buttonSortByColor_Click;
|
||||||
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||||
@ -229,7 +256,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(538, 443);
|
ClientSize = new Size(538, 554);
|
||||||
Controls.Add(Instruments);
|
Controls.Add(Instruments);
|
||||||
Controls.Add(pictureBoxCollections);
|
Controls.Add(pictureBoxCollections);
|
||||||
Controls.Add(menuStrip1);
|
Controls.Add(menuStrip1);
|
||||||
@ -249,6 +276,11 @@
|
|||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonSortByColor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
private Button ButtonRefreshCollection;
|
private Button ButtonRefreshCollection;
|
||||||
private Button ButtonRemoveLocomotive;
|
private Button ButtonRemoveLocomotive;
|
||||||
@ -269,5 +301,7 @@
|
|||||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||||
private SaveFileDialog saveFileDialog;
|
private SaveFileDialog saveFileDialog;
|
||||||
private OpenFileDialog openFileDialog;
|
private OpenFileDialog openFileDialog;
|
||||||
|
private Button buttonSortByType;
|
||||||
|
private Button buttonSortByColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -61,7 +61,7 @@ namespace ProjectElectricLocomotive
|
|||||||
_logger.LogWarning("Неудачная попытка. Коллекция не добавлена, не все данные заполнены");
|
_logger.LogWarning("Неудачная попытка. Коллекция не добавлена, не все данные заполнены");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_storage.AddSet(textBoxStorageName.Text);
|
_storage.AddSet(textBoxStorageName.Text.ToString());
|
||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
|
|
||||||
_logger.LogInformation($"Добавлен набор: {textBoxStorageName.Text}");
|
_logger.LogInformation($"Добавлен набор: {textBoxStorageName.Text}");
|
||||||
@ -115,7 +115,8 @@ namespace ProjectElectricLocomotive
|
|||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCollections.Image = obj.ShowLocomotives();
|
pictureBoxCollections.Image = obj.ShowLocomotives();
|
||||||
_logger.LogInformation($"Добавлен объект {obj}");
|
_logger.LogInformation($"Добавлен объект {obj}");
|
||||||
; }
|
;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
@ -219,5 +220,20 @@ namespace ProjectElectricLocomotive
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonSortByType_Click(object sender, EventArgs e) => CompareLocos(new LocoCompareByType());
|
||||||
|
|
||||||
|
private void buttonSortByColor_Click(object sender, EventArgs e) => CompareLocos(new LocoCompareByColor());
|
||||||
|
|
||||||
|
public void CompareLocos(IComparer<DrawingLocomotive?> comparer)
|
||||||
|
{
|
||||||
|
if (listBoxStorage.SelectedIndex == -1) return;
|
||||||
|
|
||||||
|
var obj = _storage[listBoxStorage.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if(obj == null) return;
|
||||||
|
|
||||||
|
obj.Sort(comparer);
|
||||||
|
pictureBoxCollections.Image = obj.ShowLocomotives();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml.Linq;
|
||||||
using ProjectElectricLocomotive.DrawingObjects;
|
using ProjectElectricLocomotive.DrawingObjects;
|
||||||
using ProjectElectricLocomotive.MovementStrategy;
|
using ProjectElectricLocomotive.MovementStrategy;
|
||||||
|
|
||||||
@ -15,12 +16,12 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Словарь (хранилище)
|
/// Словарь (хранилище)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
readonly Dictionary<string, LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>> _locomotivesStorage;
|
readonly Dictionary<LocosCollectionInfo, LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>> _locomotivesStorage;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Возвращение списка названий наборов
|
/// Возвращение списка названий наборов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Keys => _locomotivesStorage.Keys.ToList();
|
public List<LocosCollectionInfo> Keys => _locomotivesStorage.Keys.ToList();
|
||||||
|
|
||||||
|
|
||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
@ -34,7 +35,7 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
/// <param name="pictureHeight"></param>
|
/// <param name="pictureHeight"></param>
|
||||||
public LocomotiveGenericStorage(int pictureWidth, int pictureHeight)
|
public LocomotiveGenericStorage(int pictureWidth, int pictureHeight)
|
||||||
{
|
{
|
||||||
_locomotivesStorage = new Dictionary<string, LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>>();
|
_locomotivesStorage = new Dictionary<LocosCollectionInfo, LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>>();
|
||||||
_pictureWidth = pictureWidth;
|
_pictureWidth = pictureWidth;
|
||||||
_pictureHeight = pictureHeight;
|
_pictureHeight = pictureHeight;
|
||||||
}
|
}
|
||||||
@ -44,9 +45,10 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
/// <param name="name">Название набора</param>
|
/// <param name="name">Название набора</param>
|
||||||
public void AddSet(string name)
|
public void AddSet(string name)
|
||||||
{
|
{
|
||||||
if (!_locomotivesStorage.ContainsKey(name))
|
if (!_locomotivesStorage.ContainsKey(new LocosCollectionInfo(name, "")))
|
||||||
{
|
{
|
||||||
_locomotivesStorage.Add(name, new LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>(_pictureWidth, _pictureHeight));
|
_locomotivesStorage.Add(new LocosCollectionInfo(name, ""),
|
||||||
|
new LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>(_pictureWidth, _pictureHeight));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,9 +58,9 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
/// <param name="name">Название набора</param>
|
/// <param name="name">Название набора</param>
|
||||||
public void DelSet(string name)
|
public void DelSet(string name)
|
||||||
{
|
{
|
||||||
if (_locomotivesStorage.ContainsKey(name))
|
if (_locomotivesStorage.ContainsKey(new LocosCollectionInfo(name, "")))
|
||||||
{
|
{
|
||||||
_locomotivesStorage.Remove(name);
|
_locomotivesStorage.Remove(new LocosCollectionInfo(name, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +75,9 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_locomotivesStorage.ContainsKey(ind))
|
if (_locomotivesStorage.ContainsKey(new LocosCollectionInfo(ind, "")))
|
||||||
{
|
{
|
||||||
return _locomotivesStorage[ind];
|
return _locomotivesStorage[new LocosCollectionInfo(ind, "")];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -106,7 +108,7 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
File.Delete(filename);
|
File.Delete(filename);
|
||||||
}
|
}
|
||||||
StringBuilder data = new();
|
StringBuilder data = new();
|
||||||
foreach (KeyValuePair<string, LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>> record in _locomotivesStorage)
|
foreach (KeyValuePair<LocosCollectionInfo, LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive>> record in _locomotivesStorage)
|
||||||
{
|
{
|
||||||
StringBuilder records = new();
|
StringBuilder records = new();
|
||||||
foreach (DrawingLocomotive? elem in record.Value.GetLocomotives)
|
foreach (DrawingLocomotive? elem in record.Value.GetLocomotives)
|
||||||
@ -173,7 +175,7 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
}
|
}
|
||||||
LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive> collection = new(_pictureWidth, _pictureHeight);
|
LocomotiveGenericCollection<DrawingLocomotive, DrawingObjectLocomotive> collection = new(_pictureWidth, _pictureHeight);
|
||||||
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||||
foreach (string elem in set)
|
foreach (string elem in set/*.Reverse()*/)
|
||||||
{
|
{
|
||||||
DrawingLocomotive? loco = elem?.CreateDrawingLocomotive(_separatorForObject, _pictureWidth, _pictureHeight);
|
DrawingLocomotive? loco = elem?.CreateDrawingLocomotive(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
if (loco != null)
|
if (loco != null)
|
||||||
@ -184,7 +186,8 @@ namespace ProjectElectricLocomotive.Generics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_locomotivesStorage.Add(record[0], collection);
|
_locomotivesStorage.Add(new LocosCollectionInfo(record[0], string.Empty), collection);
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectElectricLocomotive
|
||||||
|
{
|
||||||
|
public class LocosCollectionInfo : IEquatable<LocosCollectionInfo>
|
||||||
|
{
|
||||||
|
public string Name { get; private set; }
|
||||||
|
public string Description { get; private set; }
|
||||||
|
public LocosCollectionInfo(string name, string description)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(LocosCollectionInfo other)
|
||||||
|
{
|
||||||
|
if (Name != other?.Name)
|
||||||
|
//throw new NotImplementedException(nameof(Name));
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Name.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user