8 лаба
This commit is contained in:
parent
81924c5d00
commit
4d472b3557
@ -1,5 +1,6 @@
|
||||
using ProjectAirbus.Drawnings;
|
||||
using ProjectAirbus.Exceptions;
|
||||
using System.Numerics;
|
||||
|
||||
namespace ProjectAirbus.CollectionGenericObjects;
|
||||
|
||||
@ -58,9 +59,9 @@ public abstract class AbstractCompany
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="car">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static bool operator +(AbstractCompany company, DrawningBus bus)
|
||||
public static int? operator +(AbstractCompany company, DrawningBus bus)
|
||||
{
|
||||
return company._collection?.Insert(bus, new DrawiningBusEqutables()) ?? false;
|
||||
return company._collection?.Insert(bus, new DrawiningBusEqutables());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectAirbus.CollectionGenericObjects;
|
||||
|
||||
public class CollectionInfo : IEquatable<CollectionInfo>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
|
||||
public CollectionType CollectionType { get; private set; }
|
||||
|
||||
public string Description { get; private set; }
|
||||
|
||||
private static readonly string _separator = "-";
|
||||
|
||||
public CollectionInfo(string name, CollectionType collectionType, string description)
|
||||
{
|
||||
Name = name;
|
||||
CollectionType = collectionType;
|
||||
Description = description;
|
||||
}
|
||||
|
||||
public static CollectionInfo? GetCollectionInfo(string data)
|
||||
{
|
||||
string[] strs = data.Split(_separator,
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
if (strs.Length < 1 || strs.Length > 3)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new CollectionInfo(strs[0],
|
||||
(CollectionType)Enum.Parse(typeof(CollectionType), strs[1]), strs.Length > 2 ?
|
||||
strs[2] : string.Empty);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name + _separator + CollectionType + _separator + Description;
|
||||
}
|
||||
|
||||
public bool Equals(CollectionInfo? other)
|
||||
{
|
||||
return Name == other?.Name;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return Equals(obj as CollectionInfo);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Name.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
@ -12,15 +12,21 @@ public interface ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
int Count { get; }
|
||||
int MaxCount{get;set;}
|
||||
int Insert(T obj, IEqualityComparer<DrawningBus?>? comparer = null );
|
||||
int Insert(T obj, int position, IEqualityComparer<DrawningBus?>? comparer = null);
|
||||
T? Remove(int position);
|
||||
T? Get(int position);
|
||||
|
||||
CollectionType GetCollectionType { get; }
|
||||
|
||||
IEnumerable<T> GetItems();
|
||||
void CollectionSort(IComparer<T> comparer);
|
||||
int MaxCount { set; get; }
|
||||
|
||||
int Insert(T obj, IEqualityComparer<T?>? comparer = null);
|
||||
|
||||
int Insert(T obj, int position, IEqualityComparer<T?>? comparer = null);
|
||||
|
||||
T Remove(int position);
|
||||
|
||||
T? Get(int position);
|
||||
|
||||
CollectionType GetCollectionType { get; }
|
||||
|
||||
IEnumerable<T?> GetItems();
|
||||
|
||||
void CollectionSort(IComparer<T?> comparer);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
using ProjectAirbus.CollectionGenericObjects;
|
||||
using ProjectAirbus.Drawnings;
|
||||
using ProjectAirbus.Exceptions;
|
||||
using System.Linq;
|
||||
|
||||
namespace ProjectAirBus.CollectionGenericObjects;
|
||||
namespace ProjectAirbus.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Параметризованный набор объектов
|
||||
@ -24,11 +23,22 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
|
||||
public int Count => _collection.Count;
|
||||
|
||||
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
|
||||
|
||||
public CollectionType GetCollectionType => CollectionType.List;
|
||||
public int MaxCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Count;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
_maxCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxCount { get; set; }
|
||||
public CollectionType GetCollectionType => CollectionType.List;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
@ -45,7 +55,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
return _collection[position];
|
||||
}
|
||||
|
||||
public int Insert(T obj, IEqualityComparer<DrawningBus?>? comparer = null)
|
||||
public int Insert(T obj, IEqualityComparer<T?>? comparer = null)
|
||||
{
|
||||
// TODO выброс ошибки если переполнение
|
||||
if (comparer != null)
|
||||
@ -61,7 +71,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
return Count;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position, IEqualityComparer<DrawningBus?>? comparer = null)
|
||||
public int Insert(T obj, int position, IEqualityComparer<T?>? comparer = null)
|
||||
{
|
||||
// TODO выброс ошибки если переполнение
|
||||
// TODO выброс ошибки если за границу
|
||||
@ -95,9 +105,8 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
yield return _collection[i];
|
||||
}
|
||||
}
|
||||
public void CollectionSort(IComparer<T?> comparer)
|
||||
void ICollectionGenericObjects<T>.CollectionSort(IComparer<T?> comparer)
|
||||
{
|
||||
_collection.Sort(comparer);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ namespace ProjectAirbus.CollectionGenericObjects;
|
||||
internal class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Массив объектов, которые храним
|
||||
/// </summary>
|
||||
@ -56,14 +54,14 @@ internal class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
return _collection[position];
|
||||
}
|
||||
|
||||
public int Insert(T obj, IEqualityComparer<DrawningBus?>? comparer = null)
|
||||
public int Insert(T obj, IEqualityComparer<T?>? comparer = null)
|
||||
{
|
||||
// TODO выброс ошибки если переполнение
|
||||
if (comparer != null)
|
||||
{
|
||||
foreach (T? item in _collection)
|
||||
{
|
||||
if ((comparer as IEqualityComparer<DrawingBus>).Equals(obj as DrawingBus, item as DrawingBus))
|
||||
if ((comparer as IEqualityComparer<DrawningBus>).Equals(obj as DrawningBus, item as DrawningBus))
|
||||
throw new ObjectIsEqualException();
|
||||
}
|
||||
}
|
||||
@ -81,13 +79,13 @@ internal class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
throw new CollectionOverflowException(Count);
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position, IEqualityComparer<DrawningBus?>? comparer = null)
|
||||
public int Insert(T obj, int position, IEqualityComparer<T?>? comparer = null)
|
||||
{
|
||||
if (comparer != null)
|
||||
{
|
||||
foreach (T? item in _collection)
|
||||
{
|
||||
if ((comparer as IEqualityComparer<DrawingBus>).Equals(obj as DrawingBus, item as DrawingBus))
|
||||
if ((comparer as IEqualityComparer<DrawningBus>).Equals(obj as DrawningBus, item as DrawningBus))
|
||||
throw new ObjectIsEqualException();
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,18 @@
|
||||
|
||||
|
||||
using ProjectAirbus.CollectionGenericObjects;
|
||||
using ProjectAirbus.CollectionGenericObjects;
|
||||
using ProjectAirbus.Drawnings;
|
||||
using ProjectAirbus.Exceptions;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace ProjectAirBus.CollectionGenericObjects;
|
||||
|
||||
namespace ProjectAirbus.CollectionGenericObjects;
|
||||
|
||||
public class StorageCollection<T>
|
||||
where T : DrawningBus
|
||||
{
|
||||
|
||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||
readonly Dictionary<CollectionInfo, ICollectionGenericObjects<T>> _storages;
|
||||
|
||||
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
public List<CollectionInfo> Keys => _storages.Keys.ToList();
|
||||
|
||||
private readonly string _collectionKey = "CollectionStorage";
|
||||
|
||||
@ -26,7 +22,7 @@ public class StorageCollection<T>
|
||||
|
||||
public StorageCollection()
|
||||
{
|
||||
_storages = new Dictionary<string, ICollectionGenericObjects<T>>();
|
||||
_storages = new Dictionary<CollectionInfo, ICollectionGenericObjects<T>>();
|
||||
}
|
||||
|
||||
|
||||
@ -34,27 +30,22 @@ public class StorageCollection<T>
|
||||
{
|
||||
// TODO проверка, что name не пустой и нет в словаре записи с таким ключом
|
||||
// TODO Прописать логику для добавления
|
||||
if (name == null || _storages.ContainsKey(name)) { return; }
|
||||
switch (collectionType)
|
||||
|
||||
{
|
||||
case CollectionType.None:
|
||||
return;
|
||||
case CollectionType.Massive:
|
||||
_storages[name] = new MassiveGenericObjects<T>();
|
||||
return;
|
||||
case CollectionType.List:
|
||||
_storages[name] = new ListGenericObjects<T>();
|
||||
return;
|
||||
}
|
||||
CollectionInfo collectionInfo = new CollectionInfo(name, collectionType, string.Empty);
|
||||
if (_storages.ContainsKey(collectionInfo)) return;
|
||||
if (collectionType == CollectionType.None) return;
|
||||
else if (collectionType == CollectionType.Massive)
|
||||
_storages[collectionInfo] = new MassiveGenericObjects<T>();
|
||||
else if (collectionType == CollectionType.List)
|
||||
_storages[collectionInfo] = new ListGenericObjects<T>();
|
||||
}
|
||||
|
||||
|
||||
public void DelCollection(string name)
|
||||
{
|
||||
// TODO Прописать логику для удаления коллекции
|
||||
if (_storages.ContainsKey(name))
|
||||
_storages.Remove(name);
|
||||
CollectionInfo collectionInfo = new CollectionInfo(name, CollectionType.None, string.Empty);
|
||||
if (_storages.ContainsKey(collectionInfo))
|
||||
_storages.Remove(collectionInfo);
|
||||
}
|
||||
|
||||
|
||||
@ -62,9 +53,10 @@ public class StorageCollection<T>
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO Продумать логику получения объекта
|
||||
if (name == null || !_storages.ContainsKey(name)) { return null; }
|
||||
return _storages[name];
|
||||
CollectionInfo collectionInfo = new CollectionInfo(name, CollectionType.None, string.Empty);
|
||||
if (_storages.ContainsKey(collectionInfo))
|
||||
return _storages[collectionInfo];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public void SaveData(string filename)
|
||||
@ -81,7 +73,7 @@ public class StorageCollection<T>
|
||||
StringBuilder sb = new();
|
||||
|
||||
sb.Append(_collectionKey);
|
||||
foreach (KeyValuePair<string, ICollectionGenericObjects<T>> value in _storages)
|
||||
foreach (KeyValuePair<CollectionInfo, ICollectionGenericObjects<T>> value in _storages)
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
if (value.Value.Count == 0)
|
||||
@ -145,17 +137,19 @@ public class StorageCollection<T>
|
||||
foreach (string data in strs)
|
||||
{
|
||||
string[] record = data.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (record.Length != 4)
|
||||
if (record.Length != 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
|
||||
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
|
||||
CollectionInfo? collectionInfo = CollectionInfo.GetCollectionInfo(record[0]) ??
|
||||
throw new Exception("Не удалось определить информацию коллекции: " + record[0]);
|
||||
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionInfo.CollectionType) ??
|
||||
throw new Exception("Не удалось создать коллекцию");
|
||||
if (collection == null)
|
||||
{
|
||||
throw new Exception("Не удалось создать коллекцию");
|
||||
throw new Exception("Не удалось определить тип коллекции:" + record[1]);
|
||||
}
|
||||
collection.MaxCount = Convert.ToInt32(record[2]);
|
||||
collection.MaxCount = Convert.ToInt32(record[1]);
|
||||
|
||||
string[] set = record[3].Split(_separatorItem, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
@ -176,7 +170,7 @@ public class StorageCollection<T>
|
||||
}
|
||||
}
|
||||
|
||||
_storages.Add(record[0], collection);
|
||||
_storages.Add(collectionInfo, collection);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ProjectAirbus.Exceptions;
|
||||
|
||||
[Serializable]
|
||||
public class ObjectIsEqualException : ApplicationException
|
||||
{
|
||||
public ObjectIsEqualException(int count) : base("В коллекции содержится равный элемент: " + count) { }
|
||||
public ObjectIsEqualException() : base() { }
|
||||
public ObjectIsEqualException(string message) : base(message) { }
|
||||
public ObjectIsEqualException(string message, Exception exception) : base(message, exception) { }
|
||||
protected ObjectIsEqualException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
||||
}
|
@ -30,6 +30,8 @@
|
||||
{
|
||||
groupBoxTools = new GroupBox();
|
||||
panelCompanyTools = new Panel();
|
||||
buttonSortByColor = new Button();
|
||||
buttonSortByType = new Button();
|
||||
buttonRefresh = new Button();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
buttonGoToChek = new Button();
|
||||
@ -64,34 +66,63 @@
|
||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
||||
groupBoxTools.Controls.Add(panelStorage);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(825, 28);
|
||||
groupBoxTools.Location = new Point(722, 24);
|
||||
groupBoxTools.Margin = new Padding(3, 2, 3, 2);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(303, 581);
|
||||
groupBoxTools.Padding = new Padding(3, 2, 3, 2);
|
||||
groupBoxTools.Size = new Size(265, 519);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// panelCompanyTools
|
||||
//
|
||||
panelCompanyTools.Controls.Add(buttonSortByColor);
|
||||
panelCompanyTools.Controls.Add(buttonSortByType);
|
||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||
panelCompanyTools.Controls.Add(comboBoxSelectorCompany);
|
||||
panelCompanyTools.Controls.Add(buttonGoToChek);
|
||||
panelCompanyTools.Controls.Add(buttonAddBus);
|
||||
panelCompanyTools.Controls.Add(buttonDelBus);
|
||||
panelCompanyTools.Controls.Add(maskedTextBox);
|
||||
panelCompanyTools.Dock = DockStyle.Bottom;
|
||||
panelCompanyTools.Enabled = false;
|
||||
panelCompanyTools.Location = new Point(3, 343);
|
||||
panelCompanyTools.Location = new Point(3, 301);
|
||||
panelCompanyTools.Margin = new Padding(3, 2, 3, 2);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(297, 235);
|
||||
panelCompanyTools.Size = new Size(259, 216);
|
||||
panelCompanyTools.TabIndex = 2;
|
||||
//
|
||||
// buttonSortByColor
|
||||
//
|
||||
buttonSortByColor.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSortByColor.Location = new Point(10, 182);
|
||||
buttonSortByColor.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSortByColor.Name = "buttonSortByColor";
|
||||
buttonSortByColor.Size = new Size(240, 26);
|
||||
buttonSortByColor.TabIndex = 8;
|
||||
buttonSortByColor.Text = "Сортировать по цвету";
|
||||
buttonSortByColor.UseVisualStyleBackColor = true;
|
||||
buttonSortByColor.Click += buttonSortByColor_Click;
|
||||
//
|
||||
// buttonSortByType
|
||||
//
|
||||
buttonSortByType.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonSortByType.Location = new Point(10, 152);
|
||||
buttonSortByType.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonSortByType.Name = "buttonSortByType";
|
||||
buttonSortByType.Size = new Size(240, 26);
|
||||
buttonSortByType.TabIndex = 7;
|
||||
buttonSortByType.Text = "Сортировать по типу";
|
||||
buttonSortByType.UseVisualStyleBackColor = true;
|
||||
buttonSortByType.Click += buttonSortByType_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(10, 191);
|
||||
buttonRefresh.Location = new Point(9, 122);
|
||||
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(275, 35);
|
||||
buttonRefresh.Size = new Size(240, 26);
|
||||
buttonRefresh.TabIndex = 6;
|
||||
buttonRefresh.Text = "Обновить ";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
@ -103,18 +134,20 @@
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(11, 3);
|
||||
comboBoxSelectorCompany.Location = new Point(12, 240);
|
||||
comboBoxSelectorCompany.Margin = new Padding(3, 2, 3, 2);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(267, 28);
|
||||
comboBoxSelectorCompany.Size = new Size(233, 23);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// buttonGoToChek
|
||||
//
|
||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToChek.Location = new Point(12, 150);
|
||||
buttonGoToChek.Location = new Point(10, 91);
|
||||
buttonGoToChek.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonGoToChek.Name = "buttonGoToChek";
|
||||
buttonGoToChek.Size = new Size(273, 37);
|
||||
buttonGoToChek.Size = new Size(238, 28);
|
||||
buttonGoToChek.TabIndex = 5;
|
||||
buttonGoToChek.Text = "Передать на тесты";
|
||||
buttonGoToChek.UseVisualStyleBackColor = true;
|
||||
@ -123,9 +156,10 @@
|
||||
// buttonAddBus
|
||||
//
|
||||
buttonAddBus.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddBus.Location = new Point(11, 37);
|
||||
buttonAddBus.Location = new Point(10, 7);
|
||||
buttonAddBus.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonAddBus.Name = "buttonAddBus";
|
||||
buttonAddBus.Size = new Size(270, 33);
|
||||
buttonAddBus.Size = new Size(235, 25);
|
||||
buttonAddBus.TabIndex = 1;
|
||||
buttonAddBus.Text = "Добавление самолета";
|
||||
buttonAddBus.UseVisualStyleBackColor = true;
|
||||
@ -134,9 +168,10 @@
|
||||
// buttonDelBus
|
||||
//
|
||||
buttonDelBus.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonDelBus.Location = new Point(11, 109);
|
||||
buttonDelBus.Location = new Point(10, 61);
|
||||
buttonDelBus.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonDelBus.Name = "buttonDelBus";
|
||||
buttonDelBus.Size = new Size(272, 35);
|
||||
buttonDelBus.Size = new Size(237, 26);
|
||||
buttonDelBus.TabIndex = 4;
|
||||
buttonDelBus.Text = "Удалить самолет";
|
||||
buttonDelBus.UseVisualStyleBackColor = true;
|
||||
@ -144,10 +179,11 @@
|
||||
//
|
||||
// maskedTextBox
|
||||
//
|
||||
maskedTextBox.Location = new Point(11, 76);
|
||||
maskedTextBox.Location = new Point(10, 36);
|
||||
maskedTextBox.Margin = new Padding(3, 2, 3, 2);
|
||||
maskedTextBox.Mask = "00";
|
||||
maskedTextBox.Name = "maskedTextBox";
|
||||
maskedTextBox.Size = new Size(276, 27);
|
||||
maskedTextBox.Size = new Size(242, 23);
|
||||
maskedTextBox.TabIndex = 3;
|
||||
maskedTextBox.ValidatingType = typeof(int);
|
||||
//
|
||||
@ -156,22 +192,25 @@
|
||||
panelStorage.Controls.Add(buttonCreateCompany);
|
||||
panelStorage.Controls.Add(buttonCollectionDel);
|
||||
panelStorage.Controls.Add(listBoxCollection);
|
||||
panelStorage.Controls.Add(comboBoxSelectorCompany);
|
||||
panelStorage.Controls.Add(buttonCollectionAdd);
|
||||
panelStorage.Controls.Add(radioButtonList);
|
||||
panelStorage.Controls.Add(radioButtonMassive);
|
||||
panelStorage.Controls.Add(textBoxCollectionName);
|
||||
panelStorage.Controls.Add(labelCollectionName);
|
||||
panelStorage.Dock = DockStyle.Top;
|
||||
panelStorage.Location = new Point(3, 23);
|
||||
panelStorage.Location = new Point(3, 18);
|
||||
panelStorage.Margin = new Padding(3, 2, 3, 2);
|
||||
panelStorage.Name = "panelStorage";
|
||||
panelStorage.Size = new Size(297, 317);
|
||||
panelStorage.Size = new Size(259, 279);
|
||||
panelStorage.TabIndex = 2;
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(12, 288);
|
||||
buttonCreateCompany.Location = new Point(11, 214);
|
||||
buttonCreateCompany.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(270, 29);
|
||||
buttonCreateCompany.Size = new Size(236, 22);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создать компанию ";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
||||
@ -179,9 +218,10 @@
|
||||
//
|
||||
// buttonCollectionDel
|
||||
//
|
||||
buttonCollectionDel.Location = new Point(12, 251);
|
||||
buttonCollectionDel.Location = new Point(10, 188);
|
||||
buttonCollectionDel.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||
buttonCollectionDel.Size = new Size(270, 29);
|
||||
buttonCollectionDel.Size = new Size(236, 22);
|
||||
buttonCollectionDel.TabIndex = 6;
|
||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||
buttonCollectionDel.UseVisualStyleBackColor = true;
|
||||
@ -190,16 +230,19 @@
|
||||
// listBoxCollection
|
||||
//
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.Location = new Point(12, 141);
|
||||
listBoxCollection.ItemHeight = 15;
|
||||
listBoxCollection.Location = new Point(10, 106);
|
||||
listBoxCollection.Margin = new Padding(3, 2, 3, 2);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(264, 104);
|
||||
listBoxCollection.Size = new Size(232, 79);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
//
|
||||
// buttonCollectionAdd
|
||||
//
|
||||
buttonCollectionAdd.Location = new Point(12, 96);
|
||||
buttonCollectionAdd.Location = new Point(10, 72);
|
||||
buttonCollectionAdd.Margin = new Padding(3, 2, 3, 2);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(270, 29);
|
||||
buttonCollectionAdd.Size = new Size(236, 22);
|
||||
buttonCollectionAdd.TabIndex = 4;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
||||
@ -208,9 +251,10 @@
|
||||
// radioButtonList
|
||||
//
|
||||
radioButtonList.AutoSize = true;
|
||||
radioButtonList.Location = new Point(202, 66);
|
||||
radioButtonList.Location = new Point(177, 50);
|
||||
radioButtonList.Margin = new Padding(3, 2, 3, 2);
|
||||
radioButtonList.Name = "radioButtonList";
|
||||
radioButtonList.Size = new Size(80, 24);
|
||||
radioButtonList.Size = new Size(66, 19);
|
||||
radioButtonList.TabIndex = 3;
|
||||
radioButtonList.TabStop = true;
|
||||
radioButtonList.Text = "Список";
|
||||
@ -219,9 +263,10 @@
|
||||
// radioButtonMassive
|
||||
//
|
||||
radioButtonMassive.AutoSize = true;
|
||||
radioButtonMassive.Location = new Point(12, 66);
|
||||
radioButtonMassive.Location = new Point(10, 50);
|
||||
radioButtonMassive.Margin = new Padding(3, 2, 3, 2);
|
||||
radioButtonMassive.Name = "radioButtonMassive";
|
||||
radioButtonMassive.Size = new Size(82, 24);
|
||||
radioButtonMassive.Size = new Size(67, 19);
|
||||
radioButtonMassive.TabIndex = 2;
|
||||
radioButtonMassive.TabStop = true;
|
||||
radioButtonMassive.Text = "Массив";
|
||||
@ -229,26 +274,28 @@
|
||||
//
|
||||
// textBoxCollectionName
|
||||
//
|
||||
textBoxCollectionName.Location = new Point(12, 33);
|
||||
textBoxCollectionName.Location = new Point(10, 25);
|
||||
textBoxCollectionName.Margin = new Padding(3, 2, 3, 2);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(270, 27);
|
||||
textBoxCollectionName.Size = new Size(237, 23);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
//
|
||||
// labelCollectionName
|
||||
//
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(12, 10);
|
||||
labelCollectionName.Location = new Point(10, 8);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(158, 20);
|
||||
labelCollectionName.Size = new Size(125, 15);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции:";
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Dock = DockStyle.Fill;
|
||||
pictureBox1.Location = new Point(0, 28);
|
||||
pictureBox1.Location = new Point(0, 24);
|
||||
pictureBox1.Margin = new Padding(3, 2, 3, 2);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(825, 581);
|
||||
pictureBox1.Size = new Size(722, 519);
|
||||
pictureBox1.TabIndex = 1;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
@ -258,7 +305,8 @@
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(1128, 28);
|
||||
menuStrip.Padding = new Padding(5, 2, 0, 2);
|
||||
menuStrip.Size = new Size(987, 24);
|
||||
menuStrip.TabIndex = 2;
|
||||
menuStrip.Text = "menuStrip1";
|
||||
//
|
||||
@ -266,14 +314,14 @@
|
||||
//
|
||||
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
|
||||
файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
||||
файлToolStripMenuItem.Size = new Size(59, 24);
|
||||
файлToolStripMenuItem.Size = new Size(48, 20);
|
||||
файлToolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
||||
saveToolStripMenuItem.Size = new Size(231, 26);
|
||||
saveToolStripMenuItem.Size = new Size(184, 22);
|
||||
saveToolStripMenuItem.Text = "Сохранение ";
|
||||
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
||||
//
|
||||
@ -281,7 +329,7 @@
|
||||
//
|
||||
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
||||
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
|
||||
loadToolStripMenuItem.Size = new Size(231, 26);
|
||||
loadToolStripMenuItem.Size = new Size(184, 22);
|
||||
loadToolStripMenuItem.Text = "Загрузка";
|
||||
loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
||||
//
|
||||
@ -295,14 +343,15 @@
|
||||
//
|
||||
// FormBusCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1128, 609);
|
||||
ClientSize = new Size(987, 543);
|
||||
Controls.Add(pictureBox1);
|
||||
Controls.Add(groupBoxTools);
|
||||
Controls.Add(menuStrip);
|
||||
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||
MainMenuStrip = menuStrip;
|
||||
Margin = new Padding(3, 2, 3, 2);
|
||||
Name = "FormBusCollection";
|
||||
Text = "Коллекция самолетов ";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
@ -343,6 +392,7 @@
|
||||
private ToolStripMenuItem loadToolStripMenuItem;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
private OpenFileDialog openFileDialog;
|
||||
|
||||
private Button buttonSortByColor;
|
||||
private Button buttonSortByType;
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using ProjectAirbus.CollectionGenericObjects;
|
||||
using ProjectAirbus.Drawnings;
|
||||
using ProjectAirbus.Exceptions;
|
||||
using ProjectAirBus.CollectionGenericObjects;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectAirbus;
|
||||
@ -214,7 +213,7 @@ public partial class FormBusCollection : Form
|
||||
listBoxCollection.Items.Clear();
|
||||
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
||||
{
|
||||
string? colName = _storageCollection.Keys?[i];
|
||||
string? colName = _storageCollection.Keys?[i].Name;
|
||||
if (!string.IsNullOrEmpty(colName))
|
||||
{
|
||||
listBoxCollection.Items.Add(colName);
|
||||
@ -293,4 +292,24 @@ public partial class FormBusCollection : Form
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSortByType_Click(object sender, EventArgs e)
|
||||
{
|
||||
ComparePlane(new DrawningBusCompareByType());
|
||||
}
|
||||
|
||||
private void buttonSortByColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
ComparePlane(new DrawningBusCompareByColor());
|
||||
}
|
||||
|
||||
private void ComparePlane(IComparer<DrawningBus?> comparer)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_company.Sort(comparer);
|
||||
pictureBox1.Image = _company.Show();
|
||||
}
|
||||
}
|
||||
|
@ -1,132 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>145, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>310, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
x
Reference in New Issue
Block a user