From 968b6e9588f76946379a82ef3e9243b64aa0b7a2 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 29 Dec 2023 21:27:30 +0400 Subject: [PATCH] laba 8 --- .../FormAirplaneCollection.Designer.cs | 101 +++++++++++------- Airbus_Base/FormAirplaneCollection.cs | 24 ++++- Airbus_Base/FormAirplaneCollection.resx | 9 ++ .../Generics/AirplaneCompareByColor.cs | 38 +++++++ Airbus_Base/Generics/AirplaneCompareByType.cs | 34 ++++++ .../Generics/AirplanesCollectionInfo.cs | 29 +++++ .../Generics/DrawiningAirplaneEqutables.cs | 65 +++++++++++ Airbus_Base/Generics/SetGeneric.cs | 18 +++- .../Generics/TheAirplaneGenericStorage.cs | 23 ++-- .../Generics/TheAirplanesGenericCollection.cs | 7 +- 10 files changed, 292 insertions(+), 56 deletions(-) create mode 100644 Airbus_Base/Generics/AirplaneCompareByColor.cs create mode 100644 Airbus_Base/Generics/AirplaneCompareByType.cs create mode 100644 Airbus_Base/Generics/AirplanesCollectionInfo.cs create mode 100644 Airbus_Base/Generics/DrawiningAirplaneEqutables.cs diff --git a/Airbus_Base/FormAirplaneCollection.Designer.cs b/Airbus_Base/FormAirplaneCollection.Designer.cs index 16f7632..814bc5a 100644 --- a/Airbus_Base/FormAirplaneCollection.Designer.cs +++ b/Airbus_Base/FormAirplaneCollection.Designer.cs @@ -31,6 +31,8 @@ namespace Airbus_Base private void InitializeComponent() { this.toolsPanel = new System.Windows.Forms.Panel(); + this.ButtonSortByColor = new System.Windows.Forms.Button(); + this.ButtonSortByType = new System.Windows.Forms.Button(); this.panelSets = new System.Windows.Forms.Panel(); this.textBoxStorageName = new System.Windows.Forms.TextBox(); this.listBoxObjects = new System.Windows.Forms.ListBox(); @@ -43,10 +45,10 @@ namespace Airbus_Base this.maskedTextBoxNumber = new System.Windows.Forms.TextBox(); this.LabelTools = new System.Windows.Forms.Label(); this.pictureBoxCollection = new System.Windows.Forms.PictureBox(); - this.menuStrip = new MenuStrip(); - this.FileToolStripMenuItem = new ToolStripMenuItem(); - this.SaveToolStripMenuItem = new ToolStripMenuItem(); - this.LoadToolStripMenuItem = new ToolStripMenuItem(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); this.toolsPanel.SuspendLayout(); @@ -57,6 +59,8 @@ namespace Airbus_Base // // toolsPanel // + this.toolsPanel.Controls.Add(this.ButtonSortByColor); + this.toolsPanel.Controls.Add(this.ButtonSortByType); this.toolsPanel.Controls.Add(this.panelSets); this.toolsPanel.Controls.Add(this.ButtonAddAirplane); this.toolsPanel.Controls.Add(this.ButtonDeleteAirplane); @@ -68,6 +72,26 @@ namespace Airbus_Base this.toolsPanel.Size = new System.Drawing.Size(220, 451); this.toolsPanel.TabIndex = 0; // + // ButtonSortByColor + // + this.ButtonSortByColor.Location = new System.Drawing.Point(18, 272); + this.ButtonSortByColor.Name = "ButtonSortByColor"; + this.ButtonSortByColor.Size = new System.Drawing.Size(187, 32); + this.ButtonSortByColor.TabIndex = 8; + this.ButtonSortByColor.Text = "Сортировать по цвету"; + this.ButtonSortByColor.UseVisualStyleBackColor = true; + this.ButtonSortByColor.Click += new System.EventHandler(this.ButtonSortByColor_Click); + // + // ButtonSortByType + // + this.ButtonSortByType.Location = new System.Drawing.Point(18, 234); + this.ButtonSortByType.Name = "ButtonSortByType"; + this.ButtonSortByType.Size = new System.Drawing.Size(187, 32); + this.ButtonSortByType.TabIndex = 7; + this.ButtonSortByType.Text = "Сортировать по типу"; + this.ButtonSortByType.UseVisualStyleBackColor = true; + this.ButtonSortByType.Click += new System.EventHandler(this.ButtonSortByType_Click); + // // panelSets // this.panelSets.Controls.Add(this.textBoxStorageName); @@ -128,9 +152,9 @@ namespace Airbus_Base // // ButtonAddAirplane // - this.ButtonAddAirplane.Location = new System.Drawing.Point(61, 234); + this.ButtonAddAirplane.Location = new System.Drawing.Point(41, 310); this.ButtonAddAirplane.Name = "ButtonAddAirplane"; - this.ButtonAddAirplane.Size = new System.Drawing.Size(103, 49); + this.ButtonAddAirplane.Size = new System.Drawing.Size(146, 31); this.ButtonAddAirplane.TabIndex = 1; this.ButtonAddAirplane.Text = "Добавить объект"; this.ButtonAddAirplane.UseVisualStyleBackColor = true; @@ -138,9 +162,9 @@ namespace Airbus_Base // // ButtonDeleteAirplane // - this.ButtonDeleteAirplane.Location = new System.Drawing.Point(61, 301); + this.ButtonDeleteAirplane.Location = new System.Drawing.Point(41, 345); this.ButtonDeleteAirplane.Name = "ButtonDeleteAirplane"; - this.ButtonDeleteAirplane.Size = new System.Drawing.Size(103, 55); + this.ButtonDeleteAirplane.Size = new System.Drawing.Size(146, 33); this.ButtonDeleteAirplane.TabIndex = 2; this.ButtonDeleteAirplane.Text = "Удалить объект"; this.ButtonDeleteAirplane.UseVisualStyleBackColor = true; @@ -148,9 +172,9 @@ namespace Airbus_Base // // ButtonRefreshCollection // - this.ButtonRefreshCollection.Location = new System.Drawing.Point(61, 395); + this.ButtonRefreshCollection.Location = new System.Drawing.Point(24, 417); this.ButtonRefreshCollection.Name = "ButtonRefreshCollection"; - this.ButtonRefreshCollection.Size = new System.Drawing.Size(103, 56); + this.ButtonRefreshCollection.Size = new System.Drawing.Size(184, 31); this.ButtonRefreshCollection.TabIndex = 4; this.ButtonRefreshCollection.Text = "Обновить коллекцию"; this.ButtonRefreshCollection.UseVisualStyleBackColor = true; @@ -158,7 +182,7 @@ namespace Airbus_Base // // maskedTextBoxNumber // - this.maskedTextBoxNumber.Location = new System.Drawing.Point(48, 362); + this.maskedTextBoxNumber.Location = new System.Drawing.Point(51, 384); this.maskedTextBoxNumber.Name = "maskedTextBoxNumber"; this.maskedTextBoxNumber.Size = new System.Drawing.Size(125, 27); this.maskedTextBoxNumber.TabIndex = 2; @@ -180,45 +204,46 @@ namespace Airbus_Base this.pictureBoxCollection.TabIndex = 0; this.pictureBoxCollection.TabStop = false; // - // menuStrip1 + // menuStrip // - menuStrip.ImageScalingSize = new Size(20, 20); - menuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem }); - menuStrip.Location = new Point(0, 0); - menuStrip.Name = "menuStrip"; - menuStrip.Size = new Size(882, 28); - menuStrip.TabIndex = 2; - menuStrip.Text = "menuStrip"; + this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.FileToolStripMenuItem}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(900, 28); + this.menuStrip.TabIndex = 2; + this.menuStrip.Text = "menuStrip"; // // FileToolStripMenuItem // - FileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem }); - FileToolStripMenuItem.Name = "FileToolStripMenuItem"; - FileToolStripMenuItem.Size = new Size(59, 24); - FileToolStripMenuItem.Text = "Файл"; + this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.SaveToolStripMenuItem, + this.LoadToolStripMenuItem}); + this.FileToolStripMenuItem.Name = "FileToolStripMenuItem"; + this.FileToolStripMenuItem.Size = new System.Drawing.Size(59, 24); + this.FileToolStripMenuItem.Text = "Файл"; // // SaveToolStripMenuItem // - SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; - SaveToolStripMenuItem.Size = new Size(224, 26); - SaveToolStripMenuItem.Text = "Сохранение"; - SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; + this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"; + this.SaveToolStripMenuItem.Size = new System.Drawing.Size(177, 26); + this.SaveToolStripMenuItem.Text = "Сохранение"; // // LoadToolStripMenuItem // - LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; - LoadToolStripMenuItem.Size = new Size(224, 26); - LoadToolStripMenuItem.Text = "Загрузка"; - LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; + this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem"; + this.LoadToolStripMenuItem.Size = new System.Drawing.Size(177, 26); + this.LoadToolStripMenuItem.Text = "Загрузка"; // // openFileDialog // - openFileDialog.FileName = "openFileDialog"; - openFileDialog.Filter = "txt file | *.txt"; + this.openFileDialog.FileName = "openFileDialog"; + this.openFileDialog.Filter = "txt file | *.txt"; // // saveFileDialog // - saveFileDialog.Filter = "txt file | *.txt"; + this.saveFileDialog.Filter = "txt file | *.txt"; // // FormAirplaneCollection // @@ -227,8 +252,8 @@ namespace Airbus_Base this.ClientSize = new System.Drawing.Size(900, 450); this.Controls.Add(this.pictureBoxCollection); this.Controls.Add(this.toolsPanel); - this.Controls.Add(menuStrip); - this.MainMenuStrip = menuStrip; + this.Controls.Add(this.menuStrip); + this.MainMenuStrip = this.menuStrip; this.Name = "FormAirplaneCollection"; this.Text = "FormAirplaneCollection"; this.toolsPanel.ResumeLayout(false); @@ -239,7 +264,7 @@ namespace Airbus_Base this.menuStrip.ResumeLayout(false); this.menuStrip.PerformLayout(); this.ResumeLayout(false); - PerformLayout(); + this.PerformLayout(); } @@ -269,5 +294,7 @@ namespace Airbus_Base private ToolStripMenuItem LoadToolStripMenuItem; private OpenFileDialog openFileDialog; private SaveFileDialog saveFileDialog; + private Button ButtonSortByColor; + private Button ButtonSortByType; } } \ No newline at end of file diff --git a/Airbus_Base/FormAirplaneCollection.cs b/Airbus_Base/FormAirplaneCollection.cs index 85a9e02..c2aebff 100644 --- a/Airbus_Base/FormAirplaneCollection.cs +++ b/Airbus_Base/FormAirplaneCollection.cs @@ -48,7 +48,7 @@ namespace Airbus_Base for (int i = 0; i < _storage.Keys.Count; i++) { - listBoxObjects.Items.Add(_storage.Keys[i]); + listBoxObjects.Items.Add(_storage.Keys[i].Name); } if (listBoxObjects.Items.Count > 0 && (index == -1 || index >= listBoxObjects.Items.Count)) @@ -138,10 +138,10 @@ namespace Airbus_Base pictureBoxCollection.Image = obj.ShowTheAirplanes(); Log.Information($"Добавлен объект в коллекцию {listBoxObjects.SelectedItem.ToString() ?? string.Empty}"); } - catch (StorageOverflowException ex) + catch (ArgumentException ex) { - Log.Warning($"Коллекция {listBoxObjects.SelectedItem.ToString() ?? string.Empty} переполнена"); - MessageBox.Show(ex.Message); + Log.Warning($"Добавляемый объект уже существует в коллекции {listBoxObjects.SelectedItem.ToString() ?? string.Empty}"); + MessageBox.Show("Добавляемый объект уже сущесвует в коллекции"); } }); form.AddEvent(airplaneDelegate); @@ -260,5 +260,21 @@ namespace Airbus_Base } } } + private void ButtonSortByType_Click(object sender, EventArgs e) => CompareAirplanes(new AirplaneCompareByType()); + private void ButtonSortByColor_Click(object sender, EventArgs e) => CompareAirplanes(new AirplaneCompareByColor()); + private void CompareAirplanes(IComparer comparer) + { + if (listBoxObjects.SelectedIndex == -1) + { + return; + } + var obj = _storage[listBoxObjects.SelectedItem.ToString() ?? string.Empty]; + if (obj == null) + { + return; + } + obj.Sort(comparer); + pictureBoxCollection.Image = obj.ShowTheAirplanes(); + } } } diff --git a/Airbus_Base/FormAirplaneCollection.resx b/Airbus_Base/FormAirplaneCollection.resx index f298a7b..5e83204 100644 --- a/Airbus_Base/FormAirplaneCollection.resx +++ b/Airbus_Base/FormAirplaneCollection.resx @@ -57,4 +57,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 144, 17 + + + 303, 17 + \ No newline at end of file diff --git a/Airbus_Base/Generics/AirplaneCompareByColor.cs b/Airbus_Base/Generics/AirplaneCompareByColor.cs new file mode 100644 index 0000000..24f9d1b --- /dev/null +++ b/Airbus_Base/Generics/AirplaneCompareByColor.cs @@ -0,0 +1,38 @@ +using Airbus_Base.DrawningObjects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Airbus_Base.Generics +{ + internal class AirplaneCompareByColor : IComparer + { + public int Compare(DrawningAirplane? x, DrawningAirplane? y) + { + if (x == null || x.EntityAirplane == null) + { + throw new ArgumentNullException(nameof(x)); + } + + if (y == null || y.EntityAirplane == null) + { + throw new ArgumentNullException(nameof(y)); + } + + if (x.EntityAirplane.BodyColor.Name != y.EntityAirplane.BodyColor.Name) + { + return x.EntityAirplane.BodyColor.Name.CompareTo(y.EntityAirplane.BodyColor.Name); + } + + var speedCompare = x.EntityAirplane.Speed.CompareTo(y.EntityAirplane.Speed); + if (speedCompare != 0) + { + return speedCompare; + } + + return x.EntityAirplane.Weight.CompareTo(y.EntityAirplane.Weight); + } + } +} diff --git a/Airbus_Base/Generics/AirplaneCompareByType.cs b/Airbus_Base/Generics/AirplaneCompareByType.cs new file mode 100644 index 0000000..8dcc928 --- /dev/null +++ b/Airbus_Base/Generics/AirplaneCompareByType.cs @@ -0,0 +1,34 @@ +using Airbus_Base.DrawningObjects; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Airbus_Base.Generics +{ + internal class AirplaneCompareByType : IComparer + { + public int Compare(DrawningAirplane? x, DrawningAirplane? y) + { + if (x == null || x.EntityAirplane == null) + { + throw new ArgumentNullException(nameof(x)); + } + if (y == null || y.EntityAirplane == null) + { + throw new ArgumentNullException(nameof(y)); + } + if (x.GetType().Name != y.GetType().Name) + { + return x.GetType().Name.CompareTo(y.GetType().Name); + } + var speedCompare = x.EntityAirplane.Speed.CompareTo(y.EntityAirplane.Speed); + if (speedCompare != 0) + { + return speedCompare; + } + return x.EntityAirplane.Weight.CompareTo(y.EntityAirplane.Weight); + } + } +} diff --git a/Airbus_Base/Generics/AirplanesCollectionInfo.cs b/Airbus_Base/Generics/AirplanesCollectionInfo.cs new file mode 100644 index 0000000..c6e9969 --- /dev/null +++ b/Airbus_Base/Generics/AirplanesCollectionInfo.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Airbus_Base.Generics +{ + internal class AirplanesCollectionInfo : IEquatable + { + public string Name { get; private set; } + public string Description { get; private set; } + public AirplanesCollectionInfo(string name, string description) + { + Name = name; + Description = description; + } + public bool Equals(AirplanesCollectionInfo? other) + { + if (Name == other?.Name) + return true; + return false; + } + public override int GetHashCode() + { + return this.Name.GetHashCode(); + } + } +} diff --git a/Airbus_Base/Generics/DrawiningAirplaneEqutables.cs b/Airbus_Base/Generics/DrawiningAirplaneEqutables.cs new file mode 100644 index 0000000..39f5d5d --- /dev/null +++ b/Airbus_Base/Generics/DrawiningAirplaneEqutables.cs @@ -0,0 +1,65 @@ +using Airbus_Base.DrawningObjects; +using Airbus_Base.Entities; +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Airbus_Base.Generics +{ + internal class DrawiningAirplaneEqutables : IEqualityComparer + { + public bool Equals(DrawningAirplane? x, DrawningAirplane? y) + { + if (x == null || x.EntityAirplane == null) + { + throw new ArgumentNullException(nameof(x)); + } + if (y == null || y.EntityAirplane == null) + { + throw new ArgumentNullException(nameof(y)); + } + if (x.GetType().Name != y.GetType().Name) + { + return false; + } + if (x.EntityAirplane.Speed != y.EntityAirplane.Speed) + { + return false; + } + if (x.EntityAirplane.Weight != y.EntityAirplane.Weight) + { + return false; + } + if (x.EntityAirplane.BodyColor != y.EntityAirplane.BodyColor) + { + return false; + } + if (x is DrawningAirbus && y is DrawningAirbus) + { + EntityAirbus EntityX = (EntityAirbus)x.EntityAirplane; + EntityAirbus EntityY = (EntityAirbus)y.EntityAirplane; + if (EntityX.AdditionalPassengerCompartment != EntityY.AdditionalPassengerCompartment) + { + return false; + } + if (EntityX.AdditionalEngine != EntityY.AdditionalEngine) + { + return false; + } + if (EntityX.AdditionalColor != EntityY.AdditionalColor) + { + return false; + } + } + return true; + } + + public int GetHashCode([DisallowNull] DrawningAirplane? obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/Airbus_Base/Generics/SetGeneric.cs b/Airbus_Base/Generics/SetGeneric.cs index fc0cc6d..8d8fd90 100644 --- a/Airbus_Base/Generics/SetGeneric.cs +++ b/Airbus_Base/Generics/SetGeneric.cs @@ -39,18 +39,23 @@ namespace Airbus_Base.Generics _places = new List(count); } /// + /// Сортировка набора объектов + /// + /// + public void SortSet(IComparer comparer) => _places.Sort(comparer); + /// /// Добавление объекта в набор /// /// Добавляемый самолёт /// - public void Insert(T airplane) + public void Insert(T airplane, IEqualityComparer? equal = null) { if (_places.Count == _maxCount) { throw new StorageOverflowException(_maxCount); } - Insert(airplane, 0); + Insert(airplane, 0, equal); } /// @@ -59,7 +64,7 @@ namespace Airbus_Base.Generics /// Добавляемый самолёт /// Позиция /// - public void Insert(T airplane, int position) + public void Insert(T airplane, int position, IEqualityComparer? equal = null) { if (_places.Count == _maxCount) { @@ -69,6 +74,13 @@ namespace Airbus_Base.Generics { throw new Exception("Неверная позиция для вставки"); } + if (equal != null) + { + if (_places.Contains(airplane, equal)) + { + throw new ArgumentException(nameof(airplane)); + } + } _places.Insert(position, airplane); } diff --git a/Airbus_Base/Generics/TheAirplaneGenericStorage.cs b/Airbus_Base/Generics/TheAirplaneGenericStorage.cs index f52dc9c..bd5c0c3 100644 --- a/Airbus_Base/Generics/TheAirplaneGenericStorage.cs +++ b/Airbus_Base/Generics/TheAirplaneGenericStorage.cs @@ -16,12 +16,12 @@ namespace Airbus_Base.Generics /// /// Словарь (хранилище) /// - readonly Dictionary> _airplaneStorages; + readonly Dictionary> _airplaneStorages; /// /// Возвращение списка названий наборов /// - public List Keys => _airplaneStorages.Keys.ToList(); + public List Keys => _airplaneStorages.Keys.ToList(); /// /// Ширина окна отрисовки @@ -53,7 +53,7 @@ namespace Airbus_Base.Generics /// public TheAirplaneGenericStorage(int pictureWidth, int pictureHeight) { - _airplaneStorages = new Dictionary>(); + _airplaneStorages = new Dictionary>(); _pictureWidth = pictureWidth; _pictureHeight = pictureHeight; } @@ -69,14 +69,14 @@ namespace Airbus_Base.Generics File.Delete(filename); } StringBuilder data = new(); - foreach (KeyValuePair> record in _airplaneStorages) + foreach (KeyValuePair> record in _airplaneStorages) { StringBuilder records = new(); foreach (DrawningAirplane? elem in record.Value.GetTheAirplanes) { records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}"); } - data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}"); + data.AppendLine($"{record.Key.Name}{_separatorForKeyValue}{records}"); } if (data.Length == 0) @@ -140,7 +140,7 @@ namespace Airbus_Base.Generics } } } - _airplaneStorages.Add(record[0], collection); + _airplaneStorages.Add(new AirplanesCollectionInfo(record[0], string.Empty), collection); str = sr.ReadLine(); } while (str != null); @@ -153,7 +153,7 @@ namespace Airbus_Base.Generics /// Название набора public void AddSet(string name) { - _airplaneStorages.Add(name, new TheAirplanesGenericCollection(_pictureWidth, _pictureHeight)); + _airplaneStorages.Add(new AirplanesCollectionInfo(name, string.Empty), new TheAirplanesGenericCollection(_pictureWidth, _pictureHeight)); } /// @@ -162,12 +162,12 @@ namespace Airbus_Base.Generics /// Название набора public void DelSet(string name) { - if (!_airplaneStorages.ContainsKey(name)) + if (!_airplaneStorages.ContainsKey(new AirplanesCollectionInfo(name, string.Empty))) { return; } - _airplaneStorages.Remove(name); + _airplaneStorages.Remove(new AirplanesCollectionInfo(name, string.Empty)); } /// @@ -179,9 +179,10 @@ namespace Airbus_Base.Generics { get { - if (_airplaneStorages.ContainsKey(ind)) + AirplanesCollectionInfo indObj = new AirplanesCollectionInfo(ind, string.Empty); + if (_airplaneStorages.ContainsKey(indObj)) { - return _airplaneStorages[ind]; + return _airplaneStorages[indObj]; } return null; diff --git a/Airbus_Base/Generics/TheAirplanesGenericCollection.cs b/Airbus_Base/Generics/TheAirplanesGenericCollection.cs index 725fafa..7ff49bd 100644 --- a/Airbus_Base/Generics/TheAirplanesGenericCollection.cs +++ b/Airbus_Base/Generics/TheAirplanesGenericCollection.cs @@ -22,6 +22,11 @@ namespace Airbus_Base.Generics /// public IEnumerable GetTheAirplanes => _collection.GetTheAirplanes(); /// + /// Сортировка + /// + /// + public void Sort(IComparer comparer) => _collection.SortSet(comparer); + /// /// Ширина окна прорисовки /// private readonly int _pictureWidth; @@ -72,7 +77,7 @@ namespace Airbus_Base.Generics { return false; } - collect?._collection.Insert(obj); + collect?._collection.Insert(obj, new DrawiningAirplaneEqutables()); return true; }