This commit is contained in:
Дима 2024-08-30 02:02:32 +04:00
parent af27f69e86
commit 03bfa682f7
16 changed files with 579 additions and 219 deletions

View File

@ -57,11 +57,11 @@ namespace ProjectBoat.CollectionGenericObjects
/// Перегрузка оператора сложения для класса /// Перегрузка оператора сложения для класса
/// </summary> /// </summary>
/// <param name="company">Компания</param> /// <param name="company">Компания</param>
/// <param name="сruiser">Добавляемый объект</param> /// <param name="boat">Добавляемый объект</param>
/// <returns></returns> /// <returns></returns>
public static int operator +(AbstractCompany company, DrawningBoat сruiser) public static int operator +(AbstractCompany company, DrawningBoat boat)
{ {
return company._collection.Insert(сruiser); return company._collection.Insert(boat, new DrawiningBoatEqutables());
} }
/// <summary> /// <summary>
@ -109,6 +109,13 @@ namespace ProjectBoat.CollectionGenericObjects
} }
return bitmap; return bitmap;
} }
/// <summary>
/// Сортировка
/// </summary>
/// <param name="comparer">Сравнитель объектов</param>
public void Sort(IComparer<DrawningBoat?> comparer) => _collection?.CollectionSort(comparer);
/// <summary> /// <summary>
/// Вывод заднего фона /// Вывод заднего фона
/// </summary> /// </summary>

View File

@ -0,0 +1,75 @@
namespace ProjectBoat.CollectionGenericObjects;
public class CollectionInfo : IEquatable<CollectionInfo>
{
/// <summary>
/// Название
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Тип
/// </summary>
public CollectionType CollectionType { get; private set; }
/// <summary>
/// Описание
/// </summary>
public string Description { get; private set; }
/// <summary>
/// Разделитель для записи информации по объекту в файл
/// </summary>
private static readonly string _separator = "-";
/// <summary>
/// Конструктор
/// </summary>
/// <param name="name">Название</param>
/// <param name="collectionType">Тип</param>
/// <param name="description">Описание</param>
public CollectionInfo(string name, CollectionType collectionType, string
description)
{
Name = name;
CollectionType = collectionType;
Description = description;
}
/// <summary>
/// Создание объекта из строки
/// </summary>
/// <param name="data">Строка</param>
/// <returns>Объект или null</returns>
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();
}
}

View File

@ -1,4 +1,7 @@
namespace ProjectBoat.CollectionGenericObjects using ProjectBoat.Drawnings;
using ProjectBoat.CollectionGenericObjects;
namespace ProjectBoat.CollectionGenericObjects
{ {
/// <summary> /// <summary>
/// Интерфейс описания действий для набора хранимых объектов /// Интерфейс описания действий для набора хранимых объектов
@ -21,8 +24,9 @@
/// Добавление объекта в коллекцию /// Добавление объекта в коллекцию
/// </summary> /// </summary>
/// <param name="obj">Добавляемый объект</param> /// <param name="obj">Добавляемый объект</param>
/// /// <param name="comparer">Cравнение двух объектов</param>
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns> /// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
int Insert(T obj); int Insert(T obj, IEqualityComparer<DrawningBoat?>? comparer = null);
/// <summary> /// <summary>
/// Добавление объекта в коллекцию на конкретную позицию /// Добавление объекта в коллекцию на конкретную позицию
@ -30,7 +34,7 @@
/// <param name="obj">Добавляемый объект</param> /// <param name="obj">Добавляемый объект</param>
/// <param name="position">Позиция</param> /// <param name="position">Позиция</param>
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns> /// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
int Insert(T obj, int position); int Insert(T obj, int position, IEqualityComparer<DrawningBoat?>? comparer = null);
/// <summary> /// <summary>
/// Удаление объекта из коллекции с конкретной позиции /// Удаление объекта из коллекции с конкретной позиции
@ -56,6 +60,12 @@
/// <returns>Поэлементый вывод элементов коллекции</returns> /// <returns>Поэлементый вывод элементов коллекции</returns>
IEnumerable<T?> GetItems(); IEnumerable<T?> GetItems();
/// <summary>
/// Сортировка коллекции
/// </summary>
/// <param name="comparer">Сравнитель объектов</param>
void CollectionSort(IComparer<T?> comparer);
} }
} }

View File

@ -1,4 +1,7 @@
using ProjectBoat.Exceptions; using ProjectBoat.Drawnings;
using ProjectBoat.Exceptions;
using ProjectBoat.CollectionGenericObjects;
using ProjectBoat.Exceptions;
namespace ProjectBoat.CollectionGenericObjects namespace ProjectBoat.CollectionGenericObjects
{ {
@ -41,30 +44,44 @@ namespace ProjectBoat.CollectionGenericObjects
} }
public T? Get(int position) public T? Get(int position)
{ {
// TODO проверка позиции
// TODO проверка позиции // TODO проверка позиции
// TODO выброc позиций, если выход за границы массива // TODO выброc позиций, если выход за границы массива
if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position);
return _collection[position]; return _collection[position];
} }
public int Insert(T obj) public int Insert(T obj, IEqualityComparer<DrawningBoat?>? comparer = null)
{ {
// TODO проверка, что не превышено максимальное количество элементов // TODO проверка, что не превышено максимальное количество элементов
// TODO выбром позиций, если переполнение // TODO выбром позиций, если переполнение
// TODO выброc позиций, если такой объект есть в коллекции
// TODO вставка в конец набора // TODO вставка в конец набора
for (int i = 0; i < Count; i++)
{
if (comparer.Equals((_collection[i] as DrawningBoat), (obj as DrawningBoat))) throw new ObjectAlreadyInCollectionException(i);
}
if (Count == _maxCount) throw new CollectionOverflowException(Count); if (Count == _maxCount) throw new CollectionOverflowException(Count);
_collection.Add(obj); _collection.Add(obj);
return Count; return Count;
} }
public int Insert(T obj, int position) public int Insert(T obj, int position, IEqualityComparer<DrawningBoat?>? comparer = null)
{ {
// TODO проверка, что не превышено максимальное количество элементов // TODO проверка, что не превышено максимальное количество элементов
// TODO выброc позиций, если такой объект есть в коллекции
// TODO проверка позиции // TODO проверка позиции
// TODO вставка по позиции // TODO вставка по позиции
for (int i = 0; i < Count; i++)
{
if (comparer.Equals((_collection[i] as DrawningBoat), (obj as DrawningBoat))) throw new ObjectAlreadyInCollectionException(i);
}
if (Count == _maxCount) throw new CollectionOverflowException(Count); if (Count == _maxCount) throw new CollectionOverflowException(Count);
if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position); if (position >= Count || position < 0) throw new PositionOutOfCollectionException(position);
_collection.Insert(position, obj); _collection.Insert(position, obj);
return position; return position;
@ -73,9 +90,10 @@ namespace ProjectBoat.CollectionGenericObjects
public T Remove(int position) public T Remove(int position)
{ {
// TODO проверка позиции // TODO проверка позиции
// TODO удаление объекта из списка
// TODO выбром позиций, если выход за границы массива // TODO выбром позиций, если выход за границы массива
// TODO удаление объекта из списка
if (position >= _collection.Count || position < 0) throw new PositionOutOfCollectionException(position); if (position >= _collection.Count || position < 0) throw new PositionOutOfCollectionException(position);
T obj = _collection[position]; T obj = _collection[position];
_collection.RemoveAt(position); _collection.RemoveAt(position);
return obj; return obj;
@ -88,5 +106,10 @@ namespace ProjectBoat.CollectionGenericObjects
yield return _collection[i]; yield return _collection[i];
} }
} }
public void CollectionSort(IComparer<T?> comparer)
{
_collection.Sort(comparer);
}
} }
} }

View File

@ -1,4 +1,7 @@
using ProjectBoat.Exceptions; using ProjectBoat.Drawnings;
using ProjectBoat.Exceptions;
using ProjectBoat.CollectionGenericObjects;
using ProjectBoat.Exceptions;
namespace ProjectBoat.CollectionGenericObjects namespace ProjectBoat.CollectionGenericObjects
{ {
@ -55,34 +58,44 @@ namespace ProjectBoat.CollectionGenericObjects
return _collection[position]; return _collection[position];
} }
public int Insert(T obj) public int Insert(T obj, IEqualityComparer<DrawningBoat?>? comparer = null)
{ {
// TODO вставка в свободное место набора // TODO вставка в свободное место набора
// TODO выброc позиций, если переполнение // TODO выброc позиций, если переполнение
int index = 0; // TODO выброc позиций, если такой объект есть в коллекции
while (index < Count && _collection[index] != null) for (int i = 0; i < Count; i++)
{ {
index++; if (comparer.Equals((_collection[i] as DrawningBoat), (obj as DrawningBoat))) throw new ObjectAlreadyInCollectionException(i);
} }
if (index < Count) for (int i = 0; i < Count; i++)
{ {
_collection[index] = obj; if (_collection[i] == null)
return index; {
_collection[i] = obj;
return i;
}
} }
throw new CollectionOverflowException(Count); throw new CollectionOverflowException(Count);
} }
public int Insert(T obj, int position) public int Insert(T obj, int position, IEqualityComparer<DrawningBoat?>? comparer = null)
{ {
// TODO выброc позиций, если такой объект есть в коллекции
// TODO проверка позиции // TODO проверка позиции
// TODO выбром позиций, если выход за границы массива
// TODO проверка, что элемент массива по этой позиции пустой, если нет, то // TODO проверка, что элемент массива по этой позиции пустой, если нет, то
// ищется свободное место после этой позиции и идет вставка туда // ищется свободное место после этой позиции и идет вставка туда
// если нет после, ищем до // если нет после, ищем до
// TODO вставка
// TODO выбром позиций, если переполнение // TODO выбром позиций, если переполнение
// TODO выбром позиций, если выход за границы массива // TODO вставка
for (int i = 0; i < Count; i++)
{
if (comparer.Equals((_collection[i] as DrawningBoat), (obj as DrawningBoat))) throw new ObjectAlreadyInCollectionException(i);
}
if (position < 0 || position >= Count) throw new PositionOutOfCollectionException(position); if (position < 0 || position >= Count) throw new PositionOutOfCollectionException(position);
if (_collection[position] != null) if (_collection[position] != null)
@ -143,5 +156,10 @@ namespace ProjectBoat.CollectionGenericObjects
yield return _collection[i]; yield return _collection[i];
} }
} }
public void CollectionSort(IComparer<T?> comparer)
{
Array.Sort(_collection, comparer);
}
} }
} }

View File

@ -1,5 +1,7 @@
using ProjectBoat.Drawnings; using ProjectBoat.Drawnings;
using ProjectBoat.Exceptions; using ProjectBoat.Exceptions;
using ProjectBoat.CollectionGenericObjects;
using ProjectBoat.Exceptions;
using System.Text; using System.Text;
namespace ProjectBoat.CollectionGenericObjects namespace ProjectBoat.CollectionGenericObjects
@ -13,12 +15,12 @@ namespace ProjectBoat.CollectionGenericObjects
/// <summary> /// <summary>
/// Словарь (хранилище) с коллекциями /// Словарь (хранилище) с коллекциями
/// </summary> /// </summary>
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages; readonly Dictionary<CollectionInfo, ICollectionGenericObjects<T>> _storages;
/// <summary> /// <summary>
/// Возвращение списка названий коллекций /// Возвращение списка названий коллекций
/// </summary> /// </summary>
public List<string> Keys => _storages.Keys.ToList(); public List<CollectionInfo> Keys => _storages.Keys.ToList();
/// <summary> /// <summary>
/// Ключевое слово, с которого должен начинаться файл /// Ключевое слово, с которого должен начинаться файл
@ -40,7 +42,7 @@ namespace ProjectBoat.CollectionGenericObjects
/// </summary> /// </summary>
public StorageCollection() public StorageCollection()
{ {
_storages = new Dictionary<string, ICollectionGenericObjects<T>>(); _storages = new Dictionary<CollectionInfo, ICollectionGenericObjects<T>>();
} }
/// <summary> /// <summary>
@ -48,29 +50,40 @@ namespace ProjectBoat.CollectionGenericObjects
/// </summary> /// </summary>
/// <param name="name">Название коллекции</param> /// <param name="name">Название коллекции</param>
/// <param name="collectionType">тип коллекции</param> /// <param name="collectionType">тип коллекции</param>
public void AddCollection(string name, CollectionType collectionType) public void AddCollection(CollectionInfo name)
{ {
// TODO проверка, что name не пустой и нет в словаре записи с таким ключом // TODO проверка, что name не пустой и нет в словаре записи с таким ключом
// TODO Прописать логику для добавления // TODO Прописать логику для добавления
if (_storages.ContainsKey(name)) return; if (name == null || _storages.ContainsKey(name))
{
return;
}
if (collectionType == CollectionType.None) return; if (name.CollectionType == CollectionType.Massive)
else if (collectionType == CollectionType.Massive) {
_storages[name] = new MassiveGenericObjects<T>(); _storages.Add(name, new MassiveGenericObjects<T>());
else if (collectionType == CollectionType.List) }
_storages[name] = new ListGenericObjects<T>();
if (name.CollectionType == CollectionType.List)
{
_storages.Add(name, new ListGenericObjects<T>());
}
} }
/// <summary> /// <summary>
/// Удаление коллекции /// Удаление коллекции
/// </summary> /// </summary>
/// <param name="name">Название коллекции</param> /// <param name="name">Название коллекции</param>
public void DelCollection(string name) public void DelCollection(CollectionInfo name)
{ {
// TODO Прописать логику для удаления коллекции // TODO Прописать логику для удаления коллекции
if (_storages.ContainsKey(name)) if (name == null || !_storages.ContainsKey(name))
_storages.Remove(name); {
return;
}
_storages.Remove(name);
} }
/// <summary> /// <summary>
@ -78,19 +91,22 @@ namespace ProjectBoat.CollectionGenericObjects
/// </summary> /// </summary>
/// <param name="name">Название коллекции</param> /// <param name="name">Название коллекции</param>
/// <returns></returns> /// <returns></returns>
public ICollectionGenericObjects<T>? this[string name] public ICollectionGenericObjects<T>? this[CollectionInfo name]
{ {
get get
{ {
// TODO Продумать логику получения объекта // TODO Продумать логику получения объекта
if (_storages.ContainsKey(name)) if (_storages.ContainsKey(name))
{
return _storages[name]; return _storages[name];
}
return null; return null;
} }
} }
/// <summary> /// <summary>
/// Сохранение информации по автомобилям в хранилище в файл /// Сохранение информации по самолетам в хранилище в файл
/// </summary> /// </summary>
/// <param name="filename">Путь и имя файла</param> /// <param name="filename">Путь и имя файла</param>
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns> /// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
@ -111,7 +127,7 @@ namespace ProjectBoat.CollectionGenericObjects
using StreamWriter streamWriter = new StreamWriter(fs); using StreamWriter streamWriter = new StreamWriter(fs);
streamWriter.Write(_collectionKey); streamWriter.Write(_collectionKey);
foreach (KeyValuePair<string, ICollectionGenericObjects<T>> value in _storages) foreach (KeyValuePair<CollectionInfo, ICollectionGenericObjects<T>> value in _storages)
{ {
streamWriter.Write(Environment.NewLine); streamWriter.Write(Environment.NewLine);
@ -122,8 +138,6 @@ namespace ProjectBoat.CollectionGenericObjects
streamWriter.Write(value.Key); streamWriter.Write(value.Key);
streamWriter.Write(_separatorForKeyValue); streamWriter.Write(_separatorForKeyValue);
streamWriter.Write(value.Value.GetCollectionType);
streamWriter.Write(_separatorForKeyValue);
streamWriter.Write(value.Value.MaxCount); streamWriter.Write(value.Value.MaxCount);
streamWriter.Write(_separatorForKeyValue); streamWriter.Write(_separatorForKeyValue);
@ -164,27 +178,25 @@ namespace ProjectBoat.CollectionGenericObjects
while ((str = sr.ReadLine()) != null) while ((str = sr.ReadLine()) != null)
{ {
string[] record = str.Split(_separatorForKeyValue); string[] record = str.Split(_separatorForKeyValue);
if (record.Length != 4) if (record.Length != 3)
{ {
continue; continue;
} }
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
if (collection == null)
{
throw new InvalidOperationException("Не удалось определить тип коллекции:" + record[1]);
}
collection.MaxCount = Convert.ToInt32(record[2]); CollectionInfo? collectionInfo = CollectionInfo.GetCollectionInfo(record[0]) ??
throw new Exception("Не удалось определить информацию коллекции: " + record[0]);
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionInfo.CollectionType) ??
throw new Exception("Не удалось создать коллекцию");
collection.MaxCount = Convert.ToInt32(record[1]);
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); string[] set = record[2].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set) foreach (string elem in set)
{ {
if (elem?.CreateDrawningBoat() is T aircraft) if (elem?.CreateDrawningBoat() is T boat)
{ {
try try
{ {
if (collection.Insert(aircraft) == -1) if (collection.Insert(boat, new DrawiningBoatEqutables()) == -1)
{ {
throw new InvalidOperationException("Объект не удалось добавить в коллекцию: " + record[3]); throw new InvalidOperationException("Объект не удалось добавить в коллекцию: " + record[3]);
} }
@ -193,9 +205,13 @@ namespace ProjectBoat.CollectionGenericObjects
{ {
throw new CollectionOverflowException("Коллекция переполнена", ex); throw new CollectionOverflowException("Коллекция переполнена", ex);
} }
catch (ObjectAlreadyInCollectionException ex)
{
throw new InvalidOperationException("Объект уже присутствует в коллекции", ex);
}
} }
} }
_storages.Add(record[0], collection); _storages.Add(collectionInfo, collection);
} }
} }
} }

View File

@ -0,0 +1,54 @@
using System.Diagnostics.CodeAnalysis;
namespace ProjectBoat.Drawnings;
/// <summary>
/// Реализация сравнения двух объектов класса-прорисовки
/// </summary>
public class DrawiningBoatEqutables : IEqualityComparer<DrawningBoat?>
{
public bool Equals(DrawningBoat? x, DrawningBoat? y)
{
if (x == null || x.EntityBoat == null)
{
return false;
}
if (y == null || y.EntityBoat == null)
{
return false;
}
if (x.GetType().Name != y.GetType().Name)
{
return false;
}
if (x.EntityBoat.Speed != y.EntityBoat.Speed)
{
return false;
}
if (x.EntityBoat.Weight != y.EntityBoat.Weight)
{
return false;
}
if (x.EntityBoat.BodyColor != y.EntityBoat.BodyColor)
{
return false;
}
if (x is DrawningMBoat && y is DrawningMBoat)
{
// TODO доделать логику сравнения дополнительных параметров
}
return true;
}
public int GetHashCode([DisallowNull] DrawningBoat obj)
{
return obj.GetHashCode();
}
}

View File

@ -0,0 +1,34 @@
using ProjectBoat.Entities;
namespace ProjectBoat.Drawnings;
/// <summary>
/// Сравнение по цвету, скорости, весу
/// </summary>
public class DrawningBoatCompareByColor : IComparer<DrawningBoat?>
{
public int Compare(DrawningBoat? x, DrawningBoat? y)
{
// TODO прописать логику сравения по цветам, скорости, весу
if (x == null || x.EntityBoat == null)
{
return 1;
}
if (y == null || y.EntityBoat == null)
{
return -1;
}
var bodycolorCompare = x.EntityBoat.BodyColor.Name.CompareTo(y.EntityBoat.BodyColor.Name);
if (bodycolorCompare != 0)
{
return bodycolorCompare;
}
var speedCompare = x.EntityBoat.Speed.CompareTo(y.EntityBoat.Speed);
if (speedCompare != 0)
{
return speedCompare;
}
return x.EntityBoat.Weight.CompareTo(y.EntityBoat.Weight);
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectBoat.Drawnings;
/// <summary>
/// Сравнение по типу, скорости, весу
/// </summary>
public class DrawningBoatCompareByType : IComparer<DrawningBoat?>
{
public int Compare(DrawningBoat? x, DrawningBoat? y)
{
if (x == null || x.EntityBoat == null)
{
return 1;
}
if (y == null || y.EntityBoat == null)
{
return -1;
}
if (x.GetType().Name != y.GetType().Name)
{
return x.GetType().Name.CompareTo(y.GetType().Name);
}
var speedCompare = x.EntityBoat.Speed.CompareTo(y.EntityBoat.Speed);
if (speedCompare != 0)
{
return speedCompare;
}
return x.EntityBoat.Weight.CompareTo(y.EntityBoat.Weight);
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace ProjectBoat.Exceptions;
[Serializable]
internal class ObjectAlreadyInCollectionException : ApplicationException
{
public ObjectAlreadyInCollectionException(int index) : base("Такой объект уже присутствует в коллекции. Позиция " + index) { }
public ObjectAlreadyInCollectionException() : base() { }
public ObjectAlreadyInCollectionException(string message) : base(message) { }
public ObjectAlreadyInCollectionException(string message, Exception exception) : base(message, exception) { }
protected ObjectAlreadyInCollectionException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
}

View File

@ -38,9 +38,9 @@
panelBlue = new Panel(); panelBlue = new Panel();
panelGreen = new Panel(); panelGreen = new Panel();
panelRed = new Panel(); panelRed = new Panel();
checkBoxWeapon = new CheckBox(); checkBoxGlass = new CheckBox();
checkBoxBoat = new CheckBox(); checkBoxOars = new CheckBox();
checkBoxHelicopterArea = new CheckBox(); checkBoxMotor = new CheckBox();
numericUpDownWeight = new NumericUpDown(); numericUpDownWeight = new NumericUpDown();
labelWeight = new Label(); labelWeight = new Label();
numericUpDownSpeed = new NumericUpDown(); numericUpDownSpeed = new NumericUpDown();
@ -64,9 +64,9 @@
// groupBoxConfing // groupBoxConfing
// //
groupBoxConfing.Controls.Add(groupBoxColors); groupBoxConfing.Controls.Add(groupBoxColors);
groupBoxConfing.Controls.Add(checkBoxWeapon); groupBoxConfing.Controls.Add(checkBoxGlass);
groupBoxConfing.Controls.Add(checkBoxBoat); groupBoxConfing.Controls.Add(checkBoxOars);
groupBoxConfing.Controls.Add(checkBoxHelicopterArea); groupBoxConfing.Controls.Add(checkBoxMotor);
groupBoxConfing.Controls.Add(numericUpDownWeight); groupBoxConfing.Controls.Add(numericUpDownWeight);
groupBoxConfing.Controls.Add(labelWeight); groupBoxConfing.Controls.Add(labelWeight);
groupBoxConfing.Controls.Add(numericUpDownSpeed); groupBoxConfing.Controls.Add(numericUpDownSpeed);
@ -75,10 +75,8 @@
groupBoxConfing.Controls.Add(labelSimpleObject); groupBoxConfing.Controls.Add(labelSimpleObject);
groupBoxConfing.Dock = DockStyle.Left; groupBoxConfing.Dock = DockStyle.Left;
groupBoxConfing.Location = new Point(0, 0); groupBoxConfing.Location = new Point(0, 0);
groupBoxConfing.Margin = new Padding(3, 2, 3, 2);
groupBoxConfing.Name = "groupBoxConfing"; groupBoxConfing.Name = "groupBoxConfing";
groupBoxConfing.Padding = new Padding(3, 2, 3, 2); groupBoxConfing.Size = new Size(626, 262);
groupBoxConfing.Size = new Size(548, 196);
groupBoxConfing.TabIndex = 0; groupBoxConfing.TabIndex = 0;
groupBoxConfing.TabStop = false; groupBoxConfing.TabStop = false;
groupBoxConfing.Text = "Параметры"; groupBoxConfing.Text = "Параметры";
@ -93,11 +91,9 @@
groupBoxColors.Controls.Add(panelBlue); groupBoxColors.Controls.Add(panelBlue);
groupBoxColors.Controls.Add(panelGreen); groupBoxColors.Controls.Add(panelGreen);
groupBoxColors.Controls.Add(panelRed); groupBoxColors.Controls.Add(panelRed);
groupBoxColors.Location = new Point(286, 20); groupBoxColors.Location = new Point(327, 26);
groupBoxColors.Margin = new Padding(3, 2, 3, 2);
groupBoxColors.Name = "groupBoxColors"; groupBoxColors.Name = "groupBoxColors";
groupBoxColors.Padding = new Padding(3, 2, 3, 2); groupBoxColors.Size = new Size(280, 154);
groupBoxColors.Size = new Size(245, 116);
groupBoxColors.TabIndex = 9; groupBoxColors.TabIndex = 9;
groupBoxColors.TabStop = false; groupBoxColors.TabStop = false;
groupBoxColors.Text = "Цвета"; groupBoxColors.Text = "Цвета";
@ -105,154 +101,141 @@
// panelPurple // panelPurple
// //
panelPurple.BackColor = Color.Purple; panelPurple.BackColor = Color.Purple;
panelPurple.Location = new Point(190, 72); panelPurple.Location = new Point(217, 96);
panelPurple.Margin = new Padding(3, 2, 3, 2);
panelPurple.Name = "panelPurple"; panelPurple.Name = "panelPurple";
panelPurple.Size = new Size(42, 35); panelPurple.Size = new Size(48, 47);
panelPurple.TabIndex = 1; panelPurple.TabIndex = 1;
// //
// panelBlack // panelBlack
// //
panelBlack.BackColor = Color.Black; panelBlack.BackColor = Color.Black;
panelBlack.Location = new Point(130, 72); panelBlack.Location = new Point(149, 96);
panelBlack.Margin = new Padding(3, 2, 3, 2);
panelBlack.Name = "panelBlack"; panelBlack.Name = "panelBlack";
panelBlack.Size = new Size(42, 35); panelBlack.Size = new Size(48, 47);
panelBlack.TabIndex = 1; panelBlack.TabIndex = 1;
// //
// panelGray // panelGray
// //
panelGray.BackColor = Color.Gray; panelGray.BackColor = Color.Gray;
panelGray.Location = new Point(72, 72); panelGray.Location = new Point(82, 96);
panelGray.Margin = new Padding(3, 2, 3, 2);
panelGray.Name = "panelGray"; panelGray.Name = "panelGray";
panelGray.Size = new Size(42, 35); panelGray.Size = new Size(48, 47);
panelGray.TabIndex = 1; panelGray.TabIndex = 1;
// //
// panelWhite // panelWhite
// //
panelWhite.BackColor = Color.White; panelWhite.BackColor = Color.White;
panelWhite.Location = new Point(15, 72); panelWhite.Location = new Point(17, 96);
panelWhite.Margin = new Padding(3, 2, 3, 2);
panelWhite.Name = "panelWhite"; panelWhite.Name = "panelWhite";
panelWhite.Size = new Size(42, 35); panelWhite.Size = new Size(48, 47);
panelWhite.TabIndex = 1; panelWhite.TabIndex = 1;
// //
// panelYellow // panelYellow
// //
panelYellow.BackColor = Color.Yellow; panelYellow.BackColor = Color.Yellow;
panelYellow.Location = new Point(190, 23); panelYellow.Location = new Point(217, 31);
panelYellow.Margin = new Padding(3, 2, 3, 2);
panelYellow.Name = "panelYellow"; panelYellow.Name = "panelYellow";
panelYellow.Size = new Size(42, 35); panelYellow.Size = new Size(48, 47);
panelYellow.TabIndex = 1; panelYellow.TabIndex = 1;
// //
// panelBlue // panelBlue
// //
panelBlue.BackColor = Color.Blue; panelBlue.BackColor = Color.Blue;
panelBlue.Location = new Point(130, 23); panelBlue.Location = new Point(149, 31);
panelBlue.Margin = new Padding(3, 2, 3, 2);
panelBlue.Name = "panelBlue"; panelBlue.Name = "panelBlue";
panelBlue.Size = new Size(42, 35); panelBlue.Size = new Size(48, 47);
panelBlue.TabIndex = 1; panelBlue.TabIndex = 1;
// //
// panelGreen // panelGreen
// //
panelGreen.BackColor = Color.Green; panelGreen.BackColor = Color.Green;
panelGreen.Location = new Point(72, 23); panelGreen.Location = new Point(82, 31);
panelGreen.Margin = new Padding(3, 2, 3, 2);
panelGreen.Name = "panelGreen"; panelGreen.Name = "panelGreen";
panelGreen.Size = new Size(42, 35); panelGreen.Size = new Size(48, 47);
panelGreen.TabIndex = 1; panelGreen.TabIndex = 1;
// //
// panelRed // panelRed
// //
panelRed.BackColor = Color.Red; panelRed.BackColor = Color.Red;
panelRed.Location = new Point(15, 23); panelRed.Location = new Point(17, 31);
panelRed.Margin = new Padding(3, 2, 3, 2);
panelRed.Name = "panelRed"; panelRed.Name = "panelRed";
panelRed.Size = new Size(42, 35); panelRed.Size = new Size(48, 47);
panelRed.TabIndex = 0; panelRed.TabIndex = 0;
// //
// checkBoxWeapon // checkBoxGlass
// //
checkBoxWeapon.AutoSize = true; checkBoxGlass.AutoSize = true;
checkBoxWeapon.Location = new Point(5, 163); checkBoxGlass.Location = new Point(6, 217);
checkBoxWeapon.Margin = new Padding(3, 2, 3, 2); checkBoxGlass.Name = "checkBoxGlass";
checkBoxWeapon.Name = "checkBoxWeapon"; checkBoxGlass.Size = new Size(202, 24);
checkBoxWeapon.Size = new Size(162, 19); checkBoxGlass.TabIndex = 8;
checkBoxWeapon.TabIndex = 8; checkBoxGlass.Text = "Признак наличие пушки";
checkBoxWeapon.Text = "Признак наличие стекла"; checkBoxGlass.UseVisualStyleBackColor = true;
checkBoxWeapon.UseVisualStyleBackColor = true;
// //
// checkBoxBoat // checkBoxOars
// //
checkBoxBoat.AutoSize = true; checkBoxOars.AutoSize = true;
checkBoxBoat.Location = new Point(5, 127); checkBoxOars.Location = new Point(6, 169);
checkBoxBoat.Margin = new Padding(3, 2, 3, 2); checkBoxOars.Name = "checkBoxOars";
checkBoxBoat.Name = "checkBoxBoat"; checkBoxOars.Size = new Size(215, 24);
checkBoxBoat.Size = new Size(157, 19); checkBoxOars.TabIndex = 7;
checkBoxBoat.TabIndex = 7; checkBoxOars.Text = "Признак наличие шлюпок";
checkBoxBoat.Text = "Признак наличие весел"; checkBoxOars.UseVisualStyleBackColor = true;
checkBoxBoat.UseVisualStyleBackColor = true;
// //
// checkBoxHelicopterArea // checkBoxMotor
// //
checkBoxHelicopterArea.AutoSize = true; checkBoxMotor.AutoSize = true;
checkBoxHelicopterArea.Location = new Point(5, 92); checkBoxMotor.Location = new Point(6, 123);
checkBoxHelicopterArea.Margin = new Padding(3, 2, 3, 2); checkBoxMotor.Name = "checkBoxMotor";
checkBoxHelicopterArea.Name = "checkBoxHelicopterArea"; checkBoxMotor.Size = new Size(321, 24);
checkBoxHelicopterArea.Size = new Size(167, 19); checkBoxMotor.TabIndex = 6;
checkBoxHelicopterArea.TabIndex = 6; checkBoxMotor.Text = "Признак наличие вертолетной площадки";
checkBoxHelicopterArea.Text = "Признак наличие мотора"; checkBoxMotor.UseVisualStyleBackColor = true;
checkBoxHelicopterArea.UseVisualStyleBackColor = true;
// //
// numericUpDownWeight // numericUpDownWeight
// //
numericUpDownWeight.Location = new Point(82, 51); numericUpDownWeight.Location = new Point(94, 68);
numericUpDownWeight.Margin = new Padding(3, 2, 3, 2);
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownWeight.Name = "numericUpDownWeight"; numericUpDownWeight.Name = "numericUpDownWeight";
numericUpDownWeight.Size = new Size(100, 23); numericUpDownWeight.Size = new Size(114, 27);
numericUpDownWeight.TabIndex = 5; numericUpDownWeight.TabIndex = 5;
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
// //
// labelWeight // labelWeight
// //
labelWeight.AutoSize = true; labelWeight.AutoSize = true;
labelWeight.Location = new Point(24, 52); labelWeight.Location = new Point(27, 70);
labelWeight.Name = "labelWeight"; labelWeight.Name = "labelWeight";
labelWeight.Size = new Size(29, 15); labelWeight.Size = new Size(36, 20);
labelWeight.TabIndex = 4; labelWeight.TabIndex = 4;
labelWeight.Text = "Вес:"; labelWeight.Text = "Вес:";
// //
// numericUpDownSpeed // numericUpDownSpeed
// //
numericUpDownSpeed.Location = new Point(82, 24); numericUpDownSpeed.Location = new Point(94, 32);
numericUpDownSpeed.Margin = new Padding(3, 2, 3, 2);
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericUpDownSpeed.Name = "numericUpDownSpeed"; numericUpDownSpeed.Name = "numericUpDownSpeed";
numericUpDownSpeed.Size = new Size(100, 23); numericUpDownSpeed.Size = new Size(114, 27);
numericUpDownSpeed.TabIndex = 3; numericUpDownSpeed.TabIndex = 3;
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 }); numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
// //
// labelSpeed // labelSpeed
// //
labelSpeed.AutoSize = true; labelSpeed.AutoSize = true;
labelSpeed.Location = new Point(10, 24); labelSpeed.Location = new Point(12, 32);
labelSpeed.Name = "labelSpeed"; labelSpeed.Name = "labelSpeed";
labelSpeed.Size = new Size(62, 15); labelSpeed.Size = new Size(76, 20);
labelSpeed.TabIndex = 2; labelSpeed.TabIndex = 2;
labelSpeed.Text = "Скорость:"; labelSpeed.Text = "Скорость:";
// //
// labelModifiedObject // labelModifiedObject
// //
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle; labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
labelModifiedObject.Location = new Point(416, 152); labelModifiedObject.Location = new Point(476, 203);
labelModifiedObject.Name = "labelModifiedObject"; labelModifiedObject.Name = "labelModifiedObject";
labelModifiedObject.Size = new Size(115, 34); labelModifiedObject.Size = new Size(131, 44);
labelModifiedObject.TabIndex = 1; labelModifiedObject.TabIndex = 1;
labelModifiedObject.Text = "Продвинутый"; labelModifiedObject.Text = "Продвинутый";
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter; labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
@ -261,9 +244,9 @@
// labelSimpleObject // labelSimpleObject
// //
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
labelSimpleObject.Location = new Point(286, 152); labelSimpleObject.Location = new Point(327, 203);
labelSimpleObject.Name = "labelSimpleObject"; labelSimpleObject.Name = "labelSimpleObject";
labelSimpleObject.Size = new Size(114, 34); labelSimpleObject.Size = new Size(130, 44);
labelSimpleObject.TabIndex = 0; labelSimpleObject.TabIndex = 0;
labelSimpleObject.Text = "Простой"; labelSimpleObject.Text = "Простой";
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
@ -271,19 +254,17 @@
// //
// pictureBoxObject // pictureBoxObject
// //
pictureBoxObject.Location = new Point(10, 42); pictureBoxObject.Location = new Point(11, 56);
pictureBoxObject.Margin = new Padding(3, 2, 3, 2);
pictureBoxObject.Name = "pictureBoxObject"; pictureBoxObject.Name = "pictureBoxObject";
pictureBoxObject.Size = new Size(160, 94); pictureBoxObject.Size = new Size(183, 125);
pictureBoxObject.TabIndex = 1; pictureBoxObject.TabIndex = 1;
pictureBoxObject.TabStop = false; pictureBoxObject.TabStop = false;
// //
// buttonAdd // buttonAdd
// //
buttonAdd.Location = new Point(553, 159); buttonAdd.Location = new Point(632, 212);
buttonAdd.Margin = new Padding(3, 2, 3, 2);
buttonAdd.Name = "buttonAdd"; buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(82, 22); buttonAdd.Size = new Size(94, 29);
buttonAdd.TabIndex = 2; buttonAdd.TabIndex = 2;
buttonAdd.Text = "Добавить"; buttonAdd.Text = "Добавить";
buttonAdd.UseVisualStyleBackColor = true; buttonAdd.UseVisualStyleBackColor = true;
@ -291,10 +272,9 @@
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(648, 159); buttonCancel.Location = new Point(740, 212);
buttonCancel.Margin = new Padding(3, 2, 3, 2);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(82, 22); buttonCancel.Size = new Size(94, 29);
buttonCancel.TabIndex = 3; buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
@ -305,10 +285,9 @@
panelObject.Controls.Add(labelAdditionalColor); panelObject.Controls.Add(labelAdditionalColor);
panelObject.Controls.Add(labelBodyColor); panelObject.Controls.Add(labelBodyColor);
panelObject.Controls.Add(pictureBoxObject); panelObject.Controls.Add(pictureBoxObject);
panelObject.Location = new Point(553, 9); panelObject.Location = new Point(632, 12);
panelObject.Margin = new Padding(3, 2, 3, 2);
panelObject.Name = "panelObject"; panelObject.Name = "panelObject";
panelObject.Size = new Size(179, 146); panelObject.Size = new Size(205, 194);
panelObject.TabIndex = 4; panelObject.TabIndex = 4;
panelObject.DragDrop += PanelObject_DragDrop; panelObject.DragDrop += PanelObject_DragDrop;
panelObject.DragEnter += PanelObject_DragEnter; panelObject.DragEnter += PanelObject_DragEnter;
@ -317,9 +296,9 @@
// //
labelAdditionalColor.AllowDrop = true; labelAdditionalColor.AllowDrop = true;
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle; labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
labelAdditionalColor.Location = new Point(94, 8); labelAdditionalColor.Location = new Point(108, 11);
labelAdditionalColor.Name = "labelAdditionalColor"; labelAdditionalColor.Name = "labelAdditionalColor";
labelAdditionalColor.Size = new Size(73, 28); labelAdditionalColor.Size = new Size(83, 36);
labelAdditionalColor.TabIndex = 3; labelAdditionalColor.TabIndex = 3;
labelAdditionalColor.Text = "Доп. цвет"; labelAdditionalColor.Text = "Доп. цвет";
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
@ -330,9 +309,9 @@
// //
labelBodyColor.AllowDrop = true; labelBodyColor.AllowDrop = true;
labelBodyColor.BorderStyle = BorderStyle.FixedSingle; labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
labelBodyColor.Location = new Point(10, 8); labelBodyColor.Location = new Point(11, 11);
labelBodyColor.Name = "labelBodyColor"; labelBodyColor.Name = "labelBodyColor";
labelBodyColor.Size = new Size(73, 28); labelBodyColor.Size = new Size(83, 36);
labelBodyColor.TabIndex = 2; labelBodyColor.TabIndex = 2;
labelBodyColor.Text = "Цвет"; labelBodyColor.Text = "Цвет";
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
@ -341,14 +320,13 @@
// //
// FormBoatConfing // FormBoatConfing
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(733, 196); ClientSize = new Size(838, 262);
Controls.Add(panelObject); Controls.Add(panelObject);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonAdd); Controls.Add(buttonAdd);
Controls.Add(groupBoxConfing); Controls.Add(groupBoxConfing);
Margin = new Padding(3, 2, 3, 2);
Name = "FormBoatConfing"; Name = "FormBoatConfing";
Text = "Создание объекта"; Text = "Создание объекта";
groupBoxConfing.ResumeLayout(false); groupBoxConfing.ResumeLayout(false);
@ -370,9 +348,9 @@
private NumericUpDown numericUpDownSpeed; private NumericUpDown numericUpDownSpeed;
private Label labelSpeed; private Label labelSpeed;
private NumericUpDown numericUpDownWeight; private NumericUpDown numericUpDownWeight;
private CheckBox checkBoxHelicopterArea; private CheckBox checkBoxMotor;
private CheckBox checkBoxBoat; private CheckBox checkBoxOars;
private CheckBox checkBoxWeapon; private CheckBox checkBoxGlass;
private GroupBox groupBoxColors; private GroupBox groupBoxColors;
private Panel panelPurple; private Panel panelPurple;
private Panel panelBlack; private Panel panelBlack;

View File

@ -9,7 +9,7 @@ namespace ProjectBoat
public partial class FormBoatConfing : Form public partial class FormBoatConfing : Form
{ {
/// <summary> /// <summary>
/// Объект - прорисовка крейсера /// Объект - прорисовка артиллерийской установки
/// </summary> /// </summary>
private DrawningBoat _boat; private DrawningBoat _boat;
@ -62,8 +62,8 @@ namespace ProjectBoat
/// <summary> /// <summary>
/// Передаем информацию при нажатии на Label /// Передаем информацию при нажатии на Label
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>labelSimpleObject
/// <param name="e"></param> /// <param name="e"></param>labelSimpleObject
private void labelObject_MouseDown(object sender, MouseEventArgs e) private void labelObject_MouseDown(object sender, MouseEventArgs e)
{ {
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy); (sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
@ -95,7 +95,7 @@ namespace ProjectBoat
case "labelModifiedObject": case "labelModifiedObject":
_boat = new _boat = new
DrawningMBoat((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White, DrawningMBoat((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White,
Color.Black, checkBoxHelicopterArea.Checked, checkBoxBoat.Checked, checkBoxWeapon.Checked); Color.Black, checkBoxMotor.Checked, checkBoxOars.Checked, checkBoxGlass.Checked);
break; break;
} }
DrawObject(); DrawObject();
@ -171,7 +171,6 @@ namespace ProjectBoat
BoatDelegate?.Invoke(_boat); BoatDelegate?.Invoke(_boat);
Close(); Close();
} }
} }
} }
} }

View File

@ -40,6 +40,8 @@
labelCollectionName = new Label(); labelCollectionName = new Label();
comboBoxSelectorCompany = new ComboBox(); comboBoxSelectorCompany = new ComboBox();
panelCompanyTools = new Panel(); panelCompanyTools = new Panel();
buttonSortByColor = new Button();
buttonSortByType = new Button();
ButtonAddBoat = new Button(); ButtonAddBoat = new Button();
buttonRefresh = new Button(); buttonRefresh = new Button();
ButtonRemoveBoat = new Button(); ButtonRemoveBoat = new Button();
@ -66,18 +68,21 @@
groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Controls.Add(panelCompanyTools); groupBoxTools.Controls.Add(panelCompanyTools);
groupBoxTools.Dock = DockStyle.Right; groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(631, 28); groupBoxTools.Location = new Point(552, 24);
groupBoxTools.Margin = new Padding(3, 2, 3, 2);
groupBoxTools.Name = "groupBoxTools"; groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(222, 651); groupBoxTools.Padding = new Padding(3, 2, 3, 2);
groupBoxTools.Size = new Size(194, 492);
groupBoxTools.TabIndex = 0; groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false; groupBoxTools.TabStop = false;
groupBoxTools.Text = "инструменты"; groupBoxTools.Text = "инструменты";
// //
// buttonCreateCompany // buttonCreateCompany
// //
buttonCreateCompany.Location = new Point(21, 345); buttonCreateCompany.Location = new Point(18, 259);
buttonCreateCompany.Margin = new Padding(3, 2, 3, 2);
buttonCreateCompany.Name = "buttonCreateCompany"; buttonCreateCompany.Name = "buttonCreateCompany";
buttonCreateCompany.Size = new Size(186, 27); buttonCreateCompany.Size = new Size(163, 20);
buttonCreateCompany.TabIndex = 7; buttonCreateCompany.TabIndex = 7;
buttonCreateCompany.Text = "Создать компанию"; buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true; buttonCreateCompany.UseVisualStyleBackColor = true;
@ -93,16 +98,18 @@
panelStorage.Controls.Add(textBoxCollectionName); panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(labelCollectionName); panelStorage.Controls.Add(labelCollectionName);
panelStorage.Dock = DockStyle.Top; 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.Name = "panelStorage";
panelStorage.Size = new Size(216, 283); panelStorage.Size = new Size(188, 212);
panelStorage.TabIndex = 6; panelStorage.TabIndex = 6;
// //
// buttonCollectionDel // buttonCollectionDel
// //
buttonCollectionDel.Location = new Point(17, 247); buttonCollectionDel.Location = new Point(15, 185);
buttonCollectionDel.Margin = new Padding(3, 2, 3, 2);
buttonCollectionDel.Name = "buttonCollectionDel"; buttonCollectionDel.Name = "buttonCollectionDel";
buttonCollectionDel.Size = new Size(186, 27); buttonCollectionDel.Size = new Size(163, 20);
buttonCollectionDel.TabIndex = 6; buttonCollectionDel.TabIndex = 6;
buttonCollectionDel.Text = "Удалить коллекцию"; buttonCollectionDel.Text = "Удалить коллекцию";
buttonCollectionDel.UseVisualStyleBackColor = true; buttonCollectionDel.UseVisualStyleBackColor = true;
@ -111,17 +118,19 @@
// listBoxCollection // listBoxCollection
// //
listBoxCollection.FormattingEnabled = true; listBoxCollection.FormattingEnabled = true;
listBoxCollection.ItemHeight = 20; listBoxCollection.ItemHeight = 15;
listBoxCollection.Location = new Point(17, 137); listBoxCollection.Location = new Point(15, 103);
listBoxCollection.Margin = new Padding(3, 2, 3, 2);
listBoxCollection.Name = "listBoxCollection"; listBoxCollection.Name = "listBoxCollection";
listBoxCollection.Size = new Size(186, 104); listBoxCollection.Size = new Size(163, 79);
listBoxCollection.TabIndex = 5; listBoxCollection.TabIndex = 5;
// //
// buttonCollecctionAdd // buttonCollecctionAdd
// //
buttonCollecctionAdd.Location = new Point(17, 104); buttonCollecctionAdd.Location = new Point(15, 78);
buttonCollecctionAdd.Margin = new Padding(3, 2, 3, 2);
buttonCollecctionAdd.Name = "buttonCollecctionAdd"; buttonCollecctionAdd.Name = "buttonCollecctionAdd";
buttonCollecctionAdd.Size = new Size(186, 27); buttonCollecctionAdd.Size = new Size(163, 20);
buttonCollecctionAdd.TabIndex = 4; buttonCollecctionAdd.TabIndex = 4;
buttonCollecctionAdd.Text = "Добавить коллекцию"; buttonCollecctionAdd.Text = "Добавить коллекцию";
buttonCollecctionAdd.UseVisualStyleBackColor = true; buttonCollecctionAdd.UseVisualStyleBackColor = true;
@ -130,9 +139,10 @@
// radioButtonList // radioButtonList
// //
radioButtonList.AutoSize = true; radioButtonList.AutoSize = true;
radioButtonList.Location = new Point(123, 75); radioButtonList.Location = new Point(108, 56);
radioButtonList.Margin = new Padding(3, 2, 3, 2);
radioButtonList.Name = "radioButtonList"; radioButtonList.Name = "radioButtonList";
radioButtonList.Size = new Size(80, 24); radioButtonList.Size = new Size(66, 19);
radioButtonList.TabIndex = 3; radioButtonList.TabIndex = 3;
radioButtonList.TabStop = true; radioButtonList.TabStop = true;
radioButtonList.Text = "Список"; radioButtonList.Text = "Список";
@ -141,9 +151,10 @@
// radioButtonMassive // radioButtonMassive
// //
radioButtonMassive.AutoSize = true; radioButtonMassive.AutoSize = true;
radioButtonMassive.Location = new Point(17, 75); radioButtonMassive.Location = new Point(15, 56);
radioButtonMassive.Margin = new Padding(3, 2, 3, 2);
radioButtonMassive.Name = "radioButtonMassive"; radioButtonMassive.Name = "radioButtonMassive";
radioButtonMassive.Size = new Size(82, 24); radioButtonMassive.Size = new Size(67, 19);
radioButtonMassive.TabIndex = 2; radioButtonMassive.TabIndex = 2;
radioButtonMassive.TabStop = true; radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив"; radioButtonMassive.Text = "Массив";
@ -151,17 +162,18 @@
// //
// textBoxCollectionName // textBoxCollectionName
// //
textBoxCollectionName.Location = new Point(17, 32); textBoxCollectionName.Location = new Point(15, 24);
textBoxCollectionName.Margin = new Padding(3, 2, 3, 2);
textBoxCollectionName.Name = "textBoxCollectionName"; textBoxCollectionName.Name = "textBoxCollectionName";
textBoxCollectionName.Size = new Size(186, 27); textBoxCollectionName.Size = new Size(163, 23);
textBoxCollectionName.TabIndex = 1; textBoxCollectionName.TabIndex = 1;
// //
// labelCollectionName // labelCollectionName
// //
labelCollectionName.AutoSize = true; labelCollectionName.AutoSize = true;
labelCollectionName.Location = new Point(26, 9); labelCollectionName.Location = new Point(23, 7);
labelCollectionName.Name = "labelCollectionName"; labelCollectionName.Name = "labelCollectionName";
labelCollectionName.Size = new Size(155, 20); labelCollectionName.Size = new Size(122, 15);
labelCollectionName.TabIndex = 0; labelCollectionName.TabIndex = 0;
labelCollectionName.Text = "Название коллекции"; labelCollectionName.Text = "Название коллекции";
// //
@ -170,43 +182,73 @@
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxSelectorCompany.FormattingEnabled = true; comboBoxSelectorCompany.FormattingEnabled = true;
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(21, 311); comboBoxSelectorCompany.Location = new Point(18, 233);
comboBoxSelectorCompany.Margin = new Padding(3, 2, 3, 2);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(186, 28); comboBoxSelectorCompany.Size = new Size(163, 23);
comboBoxSelectorCompany.TabIndex = 0; comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1; comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged_1;
// //
// panelCompanyTools // panelCompanyTools
// //
panelCompanyTools.Controls.Add(buttonSortByColor);
panelCompanyTools.Controls.Add(buttonSortByType);
panelCompanyTools.Controls.Add(ButtonAddBoat); panelCompanyTools.Controls.Add(ButtonAddBoat);
panelCompanyTools.Controls.Add(buttonRefresh); panelCompanyTools.Controls.Add(buttonRefresh);
panelCompanyTools.Controls.Add(ButtonRemoveBoat); panelCompanyTools.Controls.Add(ButtonRemoveBoat);
panelCompanyTools.Controls.Add(maskedTextBoxPosision); panelCompanyTools.Controls.Add(maskedTextBoxPosision);
panelCompanyTools.Controls.Add(buttonGetToTest); panelCompanyTools.Controls.Add(buttonGetToTest);
panelCompanyTools.Enabled = false; panelCompanyTools.Enabled = false;
panelCompanyTools.Location = new Point(3, 379); panelCompanyTools.Location = new Point(3, 284);
panelCompanyTools.Margin = new Padding(3, 2, 3, 2);
panelCompanyTools.Name = "panelCompanyTools"; panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(216, 274); panelCompanyTools.Size = new Size(189, 206);
panelCompanyTools.TabIndex = 8; panelCompanyTools.TabIndex = 8;
// //
// buttonSortByColor
//
buttonSortByColor.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonSortByColor.Location = new Point(17, 181);
buttonSortByColor.Margin = new Padding(3, 2, 3, 2);
buttonSortByColor.Name = "buttonSortByColor";
buttonSortByColor.Size = new Size(163, 23);
buttonSortByColor.TabIndex = 7;
buttonSortByColor.Text = "Сортировка по цвету";
buttonSortByColor.UseVisualStyleBackColor = true;
buttonSortByColor.Click += ButtonSortByColor_Click;
//
// buttonSortByType
//
buttonSortByType.Anchor = AnchorStyles.Right;
buttonSortByType.Location = new Point(17, 149);
buttonSortByType.Margin = new Padding(3, 2, 3, 2);
buttonSortByType.Name = "buttonSortByType";
buttonSortByType.Size = new Size(163, 28);
buttonSortByType.TabIndex = 6;
buttonSortByType.Text = "Сортировка по типу";
buttonSortByType.UseVisualStyleBackColor = true;
buttonSortByType.Click += ButtonSortByType_Click;
//
// ButtonAddBoat // ButtonAddBoat
// //
ButtonAddBoat.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; ButtonAddBoat.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
ButtonAddBoat.BackgroundImageLayout = ImageLayout.Center; ButtonAddBoat.BackgroundImageLayout = ImageLayout.Center;
ButtonAddBoat.Location = new Point(18, 3); ButtonAddBoat.Location = new Point(16, 2);
ButtonAddBoat.Margin = new Padding(3, 2, 3, 2);
ButtonAddBoat.Name = "ButtonAddBoat"; ButtonAddBoat.Name = "ButtonAddBoat";
ButtonAddBoat.Size = new Size(186, 40); ButtonAddBoat.Size = new Size(163, 39);
ButtonAddBoat.TabIndex = 1; ButtonAddBoat.TabIndex = 1;
ButtonAddBoat.Text = "добваление крейсера"; ButtonAddBoat.Text = "добваление артиллерийской установки";
ButtonAddBoat.UseVisualStyleBackColor = true; ButtonAddBoat.UseVisualStyleBackColor = true;
ButtonAddBoat.Click += ButtonAddBoat_Click; ButtonAddBoat.Click += ButtonAddBoat_Click;
// //
// buttonRefresh // buttonRefresh
// //
buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonRefresh.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRefresh.Location = new Point(18, 227); buttonRefresh.Location = new Point(17, 123);
buttonRefresh.Margin = new Padding(3, 2, 3, 2);
buttonRefresh.Name = "buttonRefresh"; buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(186, 41); buttonRefresh.Size = new Size(163, 22);
buttonRefresh.TabIndex = 5; buttonRefresh.TabIndex = 5;
buttonRefresh.Text = "обновить"; buttonRefresh.Text = "обновить";
buttonRefresh.UseVisualStyleBackColor = true; buttonRefresh.UseVisualStyleBackColor = true;
@ -215,29 +257,32 @@
// ButtonRemoveBoat // ButtonRemoveBoat
// //
ButtonRemoveBoat.Anchor = AnchorStyles.Right; ButtonRemoveBoat.Anchor = AnchorStyles.Right;
ButtonRemoveBoat.Location = new Point(18, 138); ButtonRemoveBoat.Location = new Point(17, 74);
ButtonRemoveBoat.Margin = new Padding(3, 2, 3, 2);
ButtonRemoveBoat.Name = "ButtonRemoveBoat"; ButtonRemoveBoat.Name = "ButtonRemoveBoat";
ButtonRemoveBoat.Size = new Size(186, 40); ButtonRemoveBoat.Size = new Size(163, 21);
ButtonRemoveBoat.TabIndex = 3; ButtonRemoveBoat.TabIndex = 3;
ButtonRemoveBoat.Text = "удалить крейсер"; ButtonRemoveBoat.Text = "удалить установку";
ButtonRemoveBoat.UseVisualStyleBackColor = true; ButtonRemoveBoat.UseVisualStyleBackColor = true;
ButtonRemoveBoat.Click += ButtonRemoveBoat_Click; ButtonRemoveBoat.Click += ButtonRemoveBoat_Click;
// //
// maskedTextBoxPosision // maskedTextBoxPosision
// //
maskedTextBoxPosision.Location = new Point(17, 105); maskedTextBoxPosision.Location = new Point(16, 45);
maskedTextBoxPosision.Margin = new Padding(3, 2, 3, 2);
maskedTextBoxPosision.Mask = "00"; maskedTextBoxPosision.Mask = "00";
maskedTextBoxPosision.Name = "maskedTextBoxPosision"; maskedTextBoxPosision.Name = "maskedTextBoxPosision";
maskedTextBoxPosision.Size = new Size(187, 27); maskedTextBoxPosision.Size = new Size(164, 23);
maskedTextBoxPosision.TabIndex = 2; maskedTextBoxPosision.TabIndex = 2;
maskedTextBoxPosision.ValidatingType = typeof(int); maskedTextBoxPosision.ValidatingType = typeof(int);
// //
// buttonGetToTest // buttonGetToTest
// //
buttonGetToTest.Anchor = AnchorStyles.Right; buttonGetToTest.Anchor = AnchorStyles.Right;
buttonGetToTest.Location = new Point(18, 184); buttonGetToTest.Location = new Point(16, 99);
buttonGetToTest.Margin = new Padding(3, 2, 3, 2);
buttonGetToTest.Name = "buttonGetToTest"; buttonGetToTest.Name = "buttonGetToTest";
buttonGetToTest.Size = new Size(186, 40); buttonGetToTest.Size = new Size(163, 20);
buttonGetToTest.TabIndex = 4; buttonGetToTest.TabIndex = 4;
buttonGetToTest.Text = "передать на тесты"; buttonGetToTest.Text = "передать на тесты";
buttonGetToTest.UseVisualStyleBackColor = true; buttonGetToTest.UseVisualStyleBackColor = true;
@ -246,9 +291,10 @@
// pictureBoxBoat // pictureBoxBoat
// //
pictureBoxBoat.Dock = DockStyle.Fill; pictureBoxBoat.Dock = DockStyle.Fill;
pictureBoxBoat.Location = new Point(0, 28); pictureBoxBoat.Location = new Point(0, 24);
pictureBoxBoat.Margin = new Padding(3, 2, 3, 2);
pictureBoxBoat.Name = "pictureBoxBoat"; pictureBoxBoat.Name = "pictureBoxBoat";
pictureBoxBoat.Size = new Size(631, 651); pictureBoxBoat.Size = new Size(552, 492);
pictureBoxBoat.TabIndex = 1; pictureBoxBoat.TabIndex = 1;
pictureBoxBoat.TabStop = false; pictureBoxBoat.TabStop = false;
// //
@ -258,7 +304,8 @@
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem }); menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
menuStrip.Location = new Point(0, 0); menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip"; menuStrip.Name = "menuStrip";
menuStrip.Size = new Size(853, 28); menuStrip.Padding = new Padding(5, 2, 0, 2);
menuStrip.Size = new Size(746, 24);
menuStrip.TabIndex = 2; menuStrip.TabIndex = 2;
menuStrip.Text = "menuStrip1"; menuStrip.Text = "menuStrip1";
// //
@ -266,14 +313,14 @@
// //
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem }); файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
файлToolStripMenuItem.Name = айлToolStripMenuItem"; файлToolStripMenuItem.Name = айлToolStripMenuItem";
файлToolStripMenuItem.Size = new Size(59, 24); файлToolStripMenuItem.Size = new Size(48, 20);
файлToolStripMenuItem.Text = "Файл"; файлToolStripMenuItem.Text = "Файл";
// //
// saveToolStripMenuItem // saveToolStripMenuItem
// //
saveToolStripMenuItem.Name = "saveToolStripMenuItem"; saveToolStripMenuItem.Name = "saveToolStripMenuItem";
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S; saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
saveToolStripMenuItem.Size = new Size(227, 26); saveToolStripMenuItem.Size = new Size(181, 22);
saveToolStripMenuItem.Text = "Сохранение"; saveToolStripMenuItem.Text = "Сохранение";
saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click; saveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
// //
@ -281,7 +328,7 @@
// //
loadToolStripMenuItem.Name = "loadToolStripMenuItem"; loadToolStripMenuItem.Name = "loadToolStripMenuItem";
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L; loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
loadToolStripMenuItem.Size = new Size(227, 26); loadToolStripMenuItem.Size = new Size(181, 22);
loadToolStripMenuItem.Text = "Загрузка"; loadToolStripMenuItem.Text = "Загрузка";
loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click; loadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
// //
@ -295,15 +342,17 @@
// //
// FormBoatsCollection // FormBoatsCollection
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(853, 679); ClientSize = new Size(746, 516);
Controls.Add(pictureBoxBoat); Controls.Add(pictureBoxBoat);
Controls.Add(groupBoxTools); Controls.Add(groupBoxTools);
Controls.Add(menuStrip); Controls.Add(menuStrip);
MainMenuStrip = menuStrip; MainMenuStrip = menuStrip;
Margin = new Padding(3, 2, 3, 2);
Name = "FormBoatsCollection"; Name = "FormBoatsCollection";
Text = "FormBoatsCollection"; Text = "FormBoatsCollection";
Load += FormBoatsCollection_Load;
groupBoxTools.ResumeLayout(false); groupBoxTools.ResumeLayout(false);
panelStorage.ResumeLayout(false); panelStorage.ResumeLayout(false);
panelStorage.PerformLayout(); panelStorage.PerformLayout();
@ -342,5 +391,7 @@
private ToolStripMenuItem loadToolStripMenuItem; private ToolStripMenuItem loadToolStripMenuItem;
private SaveFileDialog saveFileDialog; private SaveFileDialog saveFileDialog;
private OpenFileDialog openFileDialog; private OpenFileDialog openFileDialog;
private Button buttonSortByColor;
private Button buttonSortByType;
} }
} }

View File

@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ProjectBoat.CollectionGenericObjects; using ProjectBoat.CollectionGenericObjects;
using ProjectBoat.Drawnings; using ProjectBoat.Drawnings;
using System.Windows.Forms;
namespace ProjectBoat namespace ProjectBoat
{ {
@ -42,7 +43,7 @@ namespace ProjectBoat
} }
/// <summary> /// <summary>
/// добавление крейсера /// добавление артиллерийской установки
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
@ -56,7 +57,7 @@ namespace ProjectBoat
} }
/// <summary> /// <summary>
/// Добавление крейсера в коллекцию /// Добавление артиллерийской установки в коллекцию
/// </summary> /// </summary>
/// <param name="boat"></param> /// <param name="boat"></param>
private void SetBoat(DrawningBoat? boat) private void SetBoat(DrawningBoat? boat)
@ -174,17 +175,11 @@ namespace ProjectBoat
collectionType = CollectionType.List; collectionType = CollectionType.List;
} }
try CollectionInfo collectionInfo = new CollectionInfo(textBoxCollectionName.Text, collectionType, string.Empty);
{
_storageCollection.AddCollection(textBoxCollectionName.Text, collectionType); _storageCollection.AddCollection(collectionInfo);
_logger.LogInformation("Добавление коллекции"); _logger.LogInformation("Добавление коллекции");
RerfreshListBoxItems(); RerfreshListBoxItems();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
_logger.LogError($"Ошибка: {ex.Message}", ex.Message);
}
} }
/// <summary> /// <summary>
@ -203,7 +198,10 @@ namespace ProjectBoat
{ {
return; return;
} }
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
CollectionInfo collectionInfo = new CollectionInfo(listBoxCollection.SelectedItem.ToString(), CollectionType.None, string.Empty);
_storageCollection.DelCollection(collectionInfo);
_logger.LogInformation("Коллекция удалена"); _logger.LogInformation("Коллекция удалена");
RerfreshListBoxItems(); RerfreshListBoxItems();
} }
@ -216,7 +214,7 @@ namespace ProjectBoat
listBoxCollection.Items.Clear(); listBoxCollection.Items.Clear();
for (int i = 0; i < _storageCollection.Keys?.Count; ++i) for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
{ {
string? colName = _storageCollection.Keys?[i]; string? colName = _storageCollection.Keys?[i].Name;
if (!string.IsNullOrEmpty(colName)) if (!string.IsNullOrEmpty(colName))
{ {
listBoxCollection.Items.Add(colName); listBoxCollection.Items.Add(colName);
@ -237,8 +235,8 @@ namespace ProjectBoat
return; return;
} }
ICollectionGenericObjects<DrawningBoat>? collection = CollectionInfo collectionInfo = new CollectionInfo(listBoxCollection.SelectedItem.ToString(), CollectionType.None, string.Empty);
_storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty]; ICollectionGenericObjects<DrawningBoat>? collection = _storageCollection[collectionInfo];
if (collection == null) if (collection == null)
{ {
MessageBox.Show("Коллекция не проинициализирована"); MessageBox.Show("Коллекция не проинициализирована");
@ -253,6 +251,7 @@ namespace ProjectBoat
break; break;
} }
panelCompanyTools.Enabled = true; panelCompanyTools.Enabled = true;
RerfreshListBoxItems();
} }
@ -302,5 +301,44 @@ namespace ProjectBoat
} }
} }
} }
/// <summary>
/// Сортировка по типу
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonSortByType_Click(object sender, EventArgs e)
{
CompareBoats(new DrawningBoatCompareByType());
}
/// <summary>
/// Сортировка по цвету
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonSortByColor_Click(object sender, EventArgs e)
{
CompareBoats(new DrawningBoatCompareByColor());
}
/// <summary>
/// Сортировка по сравнителю
/// </summary>
/// <param name="comparer">Сравнитель объектов</param>
private void CompareBoats(IComparer<DrawningBoat?> comparer)
{
if (_company == null)
{
return;
}
_company.Sort(comparer);
pictureBoxBoat.Image = _company.Show();
}
private void FormBoatsCollection_Load(object sender, EventArgs e)
{
}
} }
} }