diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/AbstractCompany.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/AbstractCompany.cs new file mode 100644 index 0000000..b5cc584 --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/AbstractCompany.cs @@ -0,0 +1,118 @@ +using ProjectLiner.Drawnings; + +namespace ProjectLiner.CollectionGenericObjects +{ + /// + /// Абстракция компании, хранящий коллекцию лайнеров + /// + public abstract class AbstractCompany + { + /// + /// Размер места (ширина) + /// + protected readonly int _placeSizeWidth = 210; + + /// + /// Размер места (высота) + /// + protected readonly int _placeSizeHeight = 110; + + /// + /// Ширина окна + /// + protected readonly int _pictureWidth; + + /// + /// Высота окна + /// + protected readonly int _pictureHeight; + + /// + /// Коллекция лайнеров + /// + protected ICollectionGenericObjects? _collection = null; + + /// + /// Вычисление максимального количества элементов, который можно разместить в окне + /// + private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight); + + /// + /// Конструктор + /// + /// Ширина окна + /// Высота окна + /// Коллекция лайнеров + public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects collection) + { + _pictureWidth = picWidth; + _pictureHeight = picHeight; + _collection = collection; + _collection.SetMaxCount = GetMaxCount; + } + + /// + /// Перегрузка оператора сложения для класса + /// + /// Компания + /// Добавляемый объект + /// + + public static int operator +(AbstractCompany company, DrawningCommonLiner airplan) + { + return company._collection.Insert(airplan); + } + + /// + /// Перегрузка оператора удаления для класса + /// + /// Компания + /// Номер удаляемого объекта + /// + public static DrawningCommonLiner operator -(AbstractCompany company, int position) + { + return company._collection.Remove(position) ; + } + + /// + /// Получение случайного объекта из коллекции + /// + /// + public DrawningCommonLiner? GetRandomObject() + { + Random rnd = new(); + return _collection?.Get(rnd.Next(GetMaxCount)); + } + + /// + /// Вывод всей коллекции + /// + /// + public Bitmap? Show() + { + Bitmap bitmap = new(_pictureWidth, _pictureHeight); + Graphics graphics = Graphics.FromImage(bitmap); + DrawBackgound(graphics); + + SetObjectsPosition(); + for (int i = 0; i < (_collection?.Count ?? 0); ++i) + { + DrawningCommonLiner? obj = _collection?.Get(i); + obj?.DrawTransport(graphics); + } + + return bitmap; + } + + /// + /// Вывод заднего фона + /// + /// + protected abstract void DrawBackgound(Graphics g); + + /// + /// Расстановка объектов + /// + protected abstract void SetObjectsPosition(); + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/CollectionType.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/CollectionType.cs new file mode 100644 index 0000000..d5b8c2c --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/CollectionType.cs @@ -0,0 +1,24 @@ + +namespace ProjectLiner.CollectionGenericObjects; + + +/// +/// Тип коллекции +/// +public enum CollectionType +{ + /// + /// Неопределено + /// + None = 0, + + /// + /// Массив + /// + Massive = 1, + + /// + /// Список + /// + List = 2, +} diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/ICollectionGenericObjects.cs new file mode 100644 index 0000000..776e2ad --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -0,0 +1,49 @@ +namespace ProjectLiner.CollectionGenericObjects +{ + /// + /// Интерфейс описания действий для набора хранимых объектов + /// + /// Параметр: ограничение - ссылочный тип + public interface ICollectionGenericObjects + where T : class + { + /// + /// Количество объектов в коллекции + /// + int Count { get; } + + /// + /// Установка максимального количества элементов + /// + int SetMaxCount { set; } + + /// + /// Добавление объекта в коллекцию + /// + /// Добавляемый объект + /// true - вставка прошла удачно, false - вставка не удалась + int Insert(T obj); + + /// + /// Добавление объекта в коллекцию на конкретную позицию + /// + /// Добавляемый объект + /// Позиция + /// true - вставка прошла удачно, false - вставка не удалась + int Insert(T obj, int position); + + /// + /// Удаление объекта из коллекции с конкретной позиции + /// + /// Позиция + /// true - удаление прошло удачно, false - удаление не удалось + T? Remove(int position); + + /// + /// Получение объекта по позиции + /// + /// Позиция + /// Объект + T? Get(int position); + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/LinerSharingService.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/LinerSharingService.cs new file mode 100644 index 0000000..ad2d528 --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/LinerSharingService.cs @@ -0,0 +1,64 @@ +using ProjectLiner.Drawnings; + +namespace ProjectLiner.CollectionGenericObjects; + +/// +/// Реализация абстрактной компании - лайнер +/// +public class LinerSharingService : AbstractCompany +{ + /// + /// Конструктор + /// + /// Ширина + /// Высота + /// Коллекция + public LinerSharingService(int picWidth, int picHeight, ICollectionGenericObjects collection) : base(picWidth, picHeight, collection) + { + } + + protected override void DrawBackgound(Graphics g) + { + Pen pen = new(Color.Black, 4); + for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++) + { + for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) + { + g.DrawLine(pen, i * _placeSizeWidth, (int)(j * _placeSizeHeight * 1.3), + i * _placeSizeWidth + _placeSizeWidth - 40, (int)(j * _placeSizeHeight * 1.3)); + } + g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight); + } + } + + + protected override void SetObjectsPosition() + { + int width = _pictureWidth / _placeSizeWidth; + int height = _pictureHeight / _placeSizeHeight; + + int curWidth = width - 1; + int curHeight = 0; + + for (int i = 0; i < (_collection?.Count ?? 0); i++) + { + if (_collection?.Get(i) != null) + { + _collection.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight); + _collection.Get(i)?.SetPosition(_placeSizeWidth * curWidth + 10, (int)(curHeight * _placeSizeHeight * 1.3)); + } + + if (curWidth > 0) + curWidth--; + else + { + curWidth = width - 1; + curHeight++; + } + if (curHeight > height) + { + return; + } + } + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs new file mode 100644 index 0000000..dc81bc1 --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs @@ -0,0 +1,52 @@ +using ProjectLiner.CollectionGenericObjects; + +/// +/// Параметризованный набор объектов +/// +/// Параметр: ограничение - ссылочный тип +public class ListGenericObjects : ICollectionGenericObjects + where T : class +{ + /// + /// Список объектов, которые храним + /// + private readonly List _collection; + /// + /// Максимально допустимое число объектов в списке + /// + private int _maxCount; + public int Count => _collection.Count; + public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } } + /// + /// Конструктор + /// + public ListGenericObjects() + { + _collection = new(); + } + public T? Get(int position) + { + if (position >= Count || position < 0) return null; + return _collection[position]; + } + public int Insert(T obj) + { + if (Count + 1 > _maxCount) return -1; + _collection.Add(obj); + return Count; + } + public int Insert(T obj, int position) + { + if (Count + 1 > _maxCount) return -1; + if (position < 0 || position > Count) return -1; + _collection.Insert(position, obj); + return 1; + } + public T? Remove(int position) + { + if (position < 0 || position > Count) return null; + T? temp = _collection[position]; + _collection.RemoveAt(position); + return temp; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/MassiveGenericObjects.cs new file mode 100644 index 0000000..661b751 --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/MassiveGenericObjects.cs @@ -0,0 +1,109 @@ + +namespace ProjectLiner.CollectionGenericObjects +{ + /// + /// Параметризованный набор объектов + /// + /// Параметр: ограничение - ссылочный тип + public class MassiveGenericObjects : ICollectionGenericObjects + where T : class + { + /// + /// Массив объектов, которые храним + /// + private T?[] _collection; + + public int Count => _collection.Length; + + public int SetMaxCount + { + set + { + if (value > 0) + { + if (_collection.Length > 0) + { + Array.Resize(ref _collection, value); + } + else + { + _collection = new T?[value]; + } + } + } + } + + /// + /// Конструктор + /// + public MassiveGenericObjects() + { + _collection = Array.Empty(); + } + + public T? Get(int position) + { + if (position < 0 || position >= Count) + return null; + return _collection[position]; + } + + public int Insert(T obj) + { + for (int i = 0; i < Count; i++) + { + if (_collection[i] == null) + { + _collection[i] = obj; + return i; + } + } + return -1; + } + + public int Insert(T obj, int position) + { + if (position >= Count || position < 0) return -1; + if (_collection[position] == null) + { + _collection[position] = obj; + return position; + } + int temp = position + 1; + while (temp < Count) + { + if (_collection[temp] == null) + { + _collection[temp] = obj; + return temp; + } + ++temp; + } + temp = position - 1; + while (temp >= 0) + { + if (_collection[temp] == null) + { + _collection[temp] = obj; + return temp; + } + --temp; + } + return -1; + } + + public T? Remove(int position) + { + if (position < 0 || position >= Count) + { + return null; + } + + //if (_collection[position] == null) return null; + + T? temp = _collection[position]; + _collection[position] = null; + return temp; + } + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs new file mode 100644 index 0000000..6e2ed1a --- /dev/null +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs @@ -0,0 +1,68 @@ +using ProjectLiner.CollectionGenericObjects; + +/// +/// Класс-хранилище коллекций +/// +/// +public class StorageCollection + where T : class +{ + /// + /// Словарь (хранилище) с коллекциями + /// + readonly Dictionary> _storages; + /// + /// Возвращение списка названий коллекций + /// + public List Keys => _storages.Keys.ToList(); + /// + /// Конструктор + /// + public StorageCollection() + { + _storages = new Dictionary>(); + } + /// + /// Добавление коллекции в хранилище + /// + /// Название коллекции + /// тип коллекции + public void AddCollection(string name, CollectionType collectionType) + { + if (name == null || _storages.ContainsKey(name)) { return; } + switch (collectionType) + + { + case CollectionType.None: + return; + case CollectionType.Massive: + _storages[name] = new MassiveGenericObjects(); + return; + case CollectionType.List: + _storages[name] = new ListGenericObjects(); + return; + } + } + /// + /// Удаление коллекции + /// + /// Название коллекции + public void DelCollection(string name) + { + if (_storages.ContainsKey(name)) + _storages.Remove(name); + } + /// + /// Доступ к коллекции + /// + /// Название коллекции + /// + public ICollectionGenericObjects? this[string name] + { + get + { + if (name == null || !_storages.ContainsKey(name)) { return null; } + return _storages[name]; + } + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Drawnings/DirectionType.cs b/ProjectLiner/ProjectLiner/Drawnings/DirectionType.cs new file mode 100644 index 0000000..bca182c --- /dev/null +++ b/ProjectLiner/ProjectLiner/Drawnings/DirectionType.cs @@ -0,0 +1,32 @@ +namespace ProjectLiner.Drawnings; + +/// +/// Направление перемещения +/// +public enum DirectionType +{ + /// + /// Неизвестное направление + /// + Unknow = -1, + + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Drawnings/DrawningCommonLiner.cs b/ProjectLiner/ProjectLiner/Drawnings/DrawningCommonLiner.cs new file mode 100644 index 0000000..ef854f9 --- /dev/null +++ b/ProjectLiner/ProjectLiner/Drawnings/DrawningCommonLiner.cs @@ -0,0 +1,244 @@ +using ProjectLiner.Entities; + + +namespace ProjectLiner.Drawnings; +/// +/// Класс, отвечающий за прорисовку и перемещение обычного объекта-сущности +/// +public class DrawningCommonLiner +{ + /// + /// Класс-сущность + /// + public EntityCommonLiner? EntityCommonLiner { get; protected set; } + + /// + /// Ширина окна + /// + private int? _pictureWidth; + + /// + /// Высота окна + /// + private int? _pictureHeight; + + /// + /// Левая координата прорисовки лайнера + /// + protected int? _startPosX; + + /// + /// Верхняя кооридната прорисовки лайнера + /// + protected int? _startPosY; + + /// + /// Ширина прорисовки лайнера + /// + private readonly int _drawningLinerWidth = 155; + + /// + /// Высота прорисовки лайнера + /// + private readonly int _drawningLinerHeight = 90; + + /// + /// Координата X объекта + /// + public int? GetPosX => _startPosX; + + /// + /// Координата Y объекта + /// + public int? GetPosY => _startPosY; + + /// + /// Ширина объекта + /// + public int GetWidth => _drawningLinerWidth; + + /// + /// Высота объекта + /// + public int GetHeight => _drawningLinerHeight; + + /// + /// Пустой конструктор + /// + + public DrawningCommonLiner() + { + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + /// + /// конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + + public DrawningCommonLiner(int speed, double weight, Color bodycolor) : this() + { + EntityCommonLiner = new EntityCommonLiner(speed, weight, bodycolor); + } + + /// + /// конструктор для наследников + /// + /// Высота + /// Длина + + protected DrawningCommonLiner(int drawningLinerWight, int drawningLinerHeight) : this() + { + _drawningLinerHeight = drawningLinerHeight; + _drawningLinerWidth = drawningLinerWight; + } + + /// + /// Установка границ поля + /// + /// Ширина поля + /// Высота поля + /// true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах + public bool SetPictureSize(int width, int height) + { + if (width > _drawningLinerWidth && height > _drawningLinerHeight) + { + _pictureWidth = width; + _pictureHeight = height; + if (_startPosX != null && _startPosY != null) + { + if (_startPosX.Value < 0) + _startPosX = 0; + if (_startPosY.Value < 0) + _startPosY = 0; + if (_startPosX.Value + _drawningLinerWidth > _pictureWidth) + { + _startPosX = _pictureWidth - _drawningLinerWidth; + } + if (_startPosY.Value + _drawningLinerHeight > _pictureHeight) + { + _startPosY = _pictureHeight - _drawningLinerHeight; + } + } + + return true; + } + return false; + } + + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + else + { + _startPosX = x; + _startPosY = y; + if (_startPosX.Value < 0) + _startPosX = 0; + if (_startPosY.Value < 0) + _startPosY = 0; + if (_startPosX.Value + _drawningLinerWidth > _pictureWidth) + { + _startPosX = _pictureWidth - _drawningLinerWidth; + } + if (_startPosY.Value + _drawningLinerHeight > _pictureHeight) + { + _startPosY = _pictureHeight - _drawningLinerHeight; + } + } + + } + /// + /// Изменение направления перемещения + /// + /// Направление + /// true - перемещене выполнено, false - перемещение невозможно + public bool MoveTransport(DirectionType direction) + { + if (EntityCommonLiner == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return false; + } + + switch (direction) + { + //влево + case DirectionType.Left: + if (_startPosX.Value - EntityCommonLiner.Step > 0) + { + _startPosX -= (int)EntityCommonLiner.Step; + } + return true; + //вверх + case DirectionType.Up: + if (_startPosY.Value - EntityCommonLiner.Step > 0) + { + _startPosY -= (int)EntityCommonLiner.Step; + } + return true; + // вправо + case DirectionType.Right: + if (_startPosX.Value + EntityCommonLiner.Step < _pictureWidth - _drawningLinerWidth) + { + _startPosX += (int)EntityCommonLiner.Step; + } + return true; + //вниз + case DirectionType.Down: + if (_startPosY.Value + EntityCommonLiner.Step < _pictureHeight - _drawningLinerHeight) + { + _startPosY += (int)EntityCommonLiner.Step; + } + return true; + default: + return false; + } + } + + /// + /// Прорисовка объекта + /// + /// + public virtual void DrawTransport(Graphics g) + { + if (EntityCommonLiner == null || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + Brush br = new SolidBrush(EntityCommonLiner.BodyColor); + + + // кузов лайнера + Point point1 = new Point(_startPosX.Value, _startPosY.Value + 40); + Point point2 = new Point(_startPosX.Value + 50, _startPosY.Value + 90); + Point point3 = new Point(_startPosX.Value + 135, _startPosY.Value + 90); + Point point4 = new Point(_startPosX.Value + 155, _startPosY.Value + 40); + Point[] curvePoints = { point1, point2, point3, point4 }; + g.FillPolygon(br, curvePoints); + + + // борт лайнера + Point point5 = new Point(_startPosX.Value + 40, _startPosY.Value); + Point point6 = new Point(_startPosX.Value + 140, _startPosY.Value); + Point point7 = new Point(_startPosX.Value + 140, _startPosY.Value + 40); + Point point8 = new Point(_startPosX.Value + 40, _startPosY.Value + 40); + Point[] curvePoints2 = { point5, point6, point7, point8 }; + g.FillPolygon(br, curvePoints2); + + } +} diff --git a/ProjectLiner/ProjectLiner/Drawnings/DrawningLiner.cs b/ProjectLiner/ProjectLiner/Drawnings/DrawningLiner.cs new file mode 100644 index 0000000..46a4021 --- /dev/null +++ b/ProjectLiner/ProjectLiner/Drawnings/DrawningLiner.cs @@ -0,0 +1,72 @@ +using ProjectLiner.Entities; + +namespace ProjectLiner.Drawnings; + +/// +/// Класс, отвечающий за прорисовку и перемещение объекта-сущности +/// +public class DrawningLiner : DrawningCommonLiner +{ + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия якоря + /// Признак наличия шлюпок + /// Признак наличия трубы + public DrawningLiner(int speed, double weight, Color bodycolor, Color additionalColor, bool anchor, bool boats, bool pipe) : base(150, 125) + { + EntityCommonLiner = new EntityLiner(speed, weight, bodycolor, additionalColor, anchor, boats, pipe); + + } + + public override void DrawTransport(Graphics g) + { + if (EntityCommonLiner == null || EntityCommonLiner is not EntityLiner liner || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + Brush additionalBrush = new SolidBrush(liner.AdditionalColor); + Brush br = new SolidBrush(liner.BodyColor); + + _startPosY += 40; + base.DrawTransport(g); + _startPosY -= 40; + + + // якорь + if (liner.Anchor) + { + g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 85, _startPosX.Value + 45, _startPosY.Value + 115); + g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 95, _startPosX.Value + 60, _startPosY.Value + 95); + g.DrawLine(pen, _startPosX.Value + 25, _startPosY.Value + 100, _startPosX.Value + 45, _startPosY.Value + 115); + g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 115, _startPosX.Value + 65, _startPosY.Value + 100); + } + + // шлюпки + if (liner.Boats) + { + g.FillEllipse(additionalBrush, _startPosX.Value + 40, _startPosY.Value + 85, 30, 15); + g.FillEllipse(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 85, 30, 15); + g.FillEllipse(additionalBrush, _startPosX.Value + 110, _startPosY.Value + 85, 30, 15); + } + + // труба + if (liner.Pipe) + { + + Point point9 = new Point(_startPosX.Value + 90, _startPosY.Value + 10); + Point point10 = new Point(_startPosX.Value + 90, _startPosY.Value + 40); + Point point11 = new Point(_startPosX.Value + 115, _startPosY.Value + 40); + Point point12 = new Point(_startPosX.Value + 115, _startPosY.Value + 10); + Point[] curvePoints3 = { point9, point10, point11, point12 }; + g.FillPolygon(additionalBrush, curvePoints3); + } + } + +} diff --git a/ProjectLiner/ProjectLiner/Entities/EntityCommonLiner.cs b/ProjectLiner/ProjectLiner/Entities/EntityCommonLiner.cs new file mode 100644 index 0000000..bb99401 --- /dev/null +++ b/ProjectLiner/ProjectLiner/Entities/EntityCommonLiner.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +/// +/// Класс-сущность обычного "Лайнера" +/// + +namespace ProjectLiner.Entities +{ + public class EntityCommonLiner + { + /// + /// Скорость + /// + public int Speed { get; private set; } + + /// + /// Вес + /// + public double Weight { get; private set; } + + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Шаг перемещения автомобиля + /// + public double Step => Speed * 100 / Weight; + + /// + /// Конструктор лайнера + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + + public EntityCommonLiner(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + + } + } +} diff --git a/ProjectLiner/ProjectLiner/Entities/EntityLiner.cs b/ProjectLiner/ProjectLiner/Entities/EntityLiner.cs new file mode 100644 index 0000000..18a65d3 --- /dev/null +++ b/ProjectLiner/ProjectLiner/Entities/EntityLiner.cs @@ -0,0 +1,45 @@ +namespace ProjectLiner.Entities; + +/// +/// Класс-сущность "Лайнер" +/// +public class EntityLiner: EntityCommonLiner +{ + + /// + /// Дополнительный цвет (для опциональных элементов) + /// + public Color AdditionalColor { get; private set; } + + /// + /// Признак (опция) наличия якоря + /// + public bool Anchor { get; private set; } + + /// + /// Признак (опция) наличия шлюпок + /// + public bool Boats { get; private set; } + + /// + /// Признак (опция) наличия трубы + /// + public bool Pipe { get; private set; } + + + /// + /// Инициализация полей объекта-класса спортивного автомобиля + /// + /// Дополнительный цвет + /// Признак наличия якоря + /// Признак наличия шлюпок + /// Признак наличия трубы + public EntityLiner(int speed, double weight, Color bodyColor, Color additionalColor, bool anchor, bool boats, bool pipe) : base(speed, weight, bodyColor) + { + new EntityCommonLiner(speed, weight, bodyColor); + AdditionalColor = additionalColor; + Anchor = anchor; + Boats = boats; + Pipe = pipe; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Form1.Designer.cs b/ProjectLiner/ProjectLiner/Form1.Designer.cs deleted file mode 100644 index 054e711..0000000 --- a/ProjectLiner/ProjectLiner/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectLiner -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Form1.cs b/ProjectLiner/ProjectLiner/Form1.cs deleted file mode 100644 index 9b44028..0000000 --- a/ProjectLiner/ProjectLiner/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectLiner -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/FormLiner.Designer.cs b/ProjectLiner/ProjectLiner/FormLiner.Designer.cs new file mode 100644 index 0000000..8b9984b --- /dev/null +++ b/ProjectLiner/ProjectLiner/FormLiner.Designer.cs @@ -0,0 +1,155 @@ +namespace ProjectLiner +{ + partial class FormLiner + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + pictureBoxLiner = new PictureBox(); + buttonDown = new Button(); + buttonUp = new Button(); + buttonLeft = new Button(); + buttonRight = new Button(); + comboBoxStrategy = new ComboBox(); + buttonStrategyStep = new Button(); + ((System.ComponentModel.ISupportInitialize)pictureBoxLiner).BeginInit(); + SuspendLayout(); + // + // pictureBoxLiner + // + pictureBoxLiner.BackColor = SystemColors.Control; + pictureBoxLiner.Dock = DockStyle.Fill; + pictureBoxLiner.Location = new Point(0, 0); + pictureBoxLiner.Margin = new Padding(5); + pictureBoxLiner.Name = "pictureBoxLiner"; + pictureBoxLiner.Size = new Size(1465, 1007); + pictureBoxLiner.TabIndex = 0; + pictureBoxLiner.TabStop = false; + // + // buttonDown + // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonDown.BackgroundImage = Properties.Resources.bottom; + buttonDown.BackgroundImageLayout = ImageLayout.Stretch; + buttonDown.Location = new Point(1283, 905); + buttonDown.Margin = new Padding(5); + buttonDown.Name = "buttonDown"; + buttonDown.Size = new Size(77, 82); + buttonDown.TabIndex = 2; + buttonDown.UseVisualStyleBackColor = true; + buttonDown.Click += ButtonMove_Click; + // + // buttonUp + // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonUp.BackgroundImage = Properties.Resources.top; + buttonUp.BackgroundImageLayout = ImageLayout.Stretch; + buttonUp.Location = new Point(1283, 813); + buttonUp.Margin = new Padding(5); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(77, 82); + buttonUp.TabIndex = 3; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += ButtonMove_Click; + // + // buttonLeft + // + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.left; + buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; + buttonLeft.Location = new Point(1196, 905); + buttonLeft.Margin = new Padding(5); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(77, 82); + buttonLeft.TabIndex = 4; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += ButtonMove_Click; + // + // buttonRight + // + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.right; + buttonRight.BackgroundImageLayout = ImageLayout.Stretch; + buttonRight.Location = new Point(1369, 905); + buttonRight.Margin = new Padding(5); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(77, 82); + buttonRight.TabIndex = 5; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += ButtonMove_Click; + // + // comboBoxStrategy + // + comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStrategy.FormattingEnabled = true; + comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" }); + comboBoxStrategy.Location = new Point(1147, 20); + comboBoxStrategy.Margin = new Padding(5); + comboBoxStrategy.Name = "comboBoxStrategy"; + comboBoxStrategy.Size = new Size(298, 49); + comboBoxStrategy.TabIndex = 11; + // + // buttonStrategyStep + // + buttonStrategyStep.Location = new Point(1261, 84); + buttonStrategyStep.Margin = new Padding(5); + buttonStrategyStep.Name = "buttonStrategyStep"; + buttonStrategyStep.Size = new Size(185, 61); + buttonStrategyStep.TabIndex = 12; + buttonStrategyStep.Text = "Шаг"; + buttonStrategyStep.UseVisualStyleBackColor = true; + buttonStrategyStep.Click += buttonStrategyStep_Click; + // + // FormLiner + // + AutoScaleDimensions = new SizeF(17F, 41F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(1465, 1007); + Controls.Add(buttonStrategyStep); + Controls.Add(comboBoxStrategy); + Controls.Add(buttonRight); + Controls.Add(buttonLeft); + Controls.Add(buttonUp); + Controls.Add(buttonDown); + Controls.Add(pictureBoxLiner); + Margin = new Padding(5); + Name = "FormLiner"; + Text = "Лайнер"; + ((System.ComponentModel.ISupportInitialize)pictureBoxLiner).EndInit(); + ResumeLayout(false); + } + + #endregion + + private PictureBox pictureBoxLiner; + private Button buttonDown; + private Button buttonUp; + private Button buttonLeft; + private Button buttonRight; + private ComboBox comboBoxStrategy; + private Button buttonStrategyStep; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/FormLiner.cs b/ProjectLiner/ProjectLiner/FormLiner.cs new file mode 100644 index 0000000..fbbb11d --- /dev/null +++ b/ProjectLiner/ProjectLiner/FormLiner.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ProjectLiner.Drawnings; +using ProjectLiner.MovementStrategy; + +namespace ProjectLiner +{ + public partial class FormLiner : Form + { + private DrawningCommonLiner? _drawningCommonLiner; + + private AbstractStrategy? _strategy; + public FormLiner() + { + InitializeComponent(); + _strategy = null; + } + + + /// + /// Стратегия перемещения + /// + + public DrawningCommonLiner SetLiner + { + set + { + _drawningCommonLiner = value; + _drawningCommonLiner.SetPictureSize(pictureBoxLiner.Width, pictureBoxLiner.Height); + comboBoxStrategy.Enabled = true; + _strategy = null; + Draw(); + } + } + + /// + /// Метод прорисовки лайнера + /// + private void Draw() + { + if (_drawningCommonLiner == null) + { + return; + } + + Bitmap bmp = new(pictureBoxLiner.Width, pictureBoxLiner.Height); + Graphics gr = Graphics.FromImage(bmp); + _drawningCommonLiner.DrawTransport(gr); + pictureBoxLiner.Image = bmp; + } + + + /// + /// Перемещение объекта по форме (нажатие кнопок навигации) + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + if (_drawningCommonLiner == null) + { + return; + } + + string name = ((Button)sender)?.Name ?? string.Empty; + bool result = false; + switch (name) + { + case "buttonUp": + result = _drawningCommonLiner.MoveTransport(DirectionType.Up); + break; + case "buttonDown": + result = _drawningCommonLiner.MoveTransport(DirectionType.Down); + break; + case "buttonLeft": + result = _drawningCommonLiner.MoveTransport(DirectionType.Left); + break; + case "buttonRight": + result = _drawningCommonLiner.MoveTransport(DirectionType.Right); + break; + } + + if (result) + { + Draw(); + } + } + + /// + /// Обработка нажатия кнопки "Шаг" + /// + /// + /// + private void buttonStrategyStep_Click(object sender, EventArgs e) + { + if (_drawningCommonLiner == null) + { + return; + } + + if (comboBoxStrategy.Enabled) + { + _strategy = comboBoxStrategy.SelectedIndex switch + { + 0 => new MoveToCenter(), + 1 => new MoveToBorder(), + _ => null, + }; + if (_strategy == null) + { + return; + } + _strategy.SetData(new MoveableLiner(_drawningCommonLiner), pictureBoxLiner.Width, pictureBoxLiner.Height); + } + + if (_strategy == null) + { + return; + } + + comboBoxStrategy.Enabled = false; + _strategy.MakeStep(); + Draw(); + + if (_strategy.GetStatus() == StrategyStatus.Finish) + { + comboBoxStrategy.Enabled = true; + _strategy = null; + } + } + } +} diff --git a/ProjectLiner/ProjectLiner/Form1.resx b/ProjectLiner/ProjectLiner/FormLiner.resx similarity index 93% rename from ProjectLiner/ProjectLiner/Form1.resx rename to ProjectLiner/ProjectLiner/FormLiner.resx index 1af7de1..af32865 100644 --- a/ProjectLiner/ProjectLiner/Form1.resx +++ b/ProjectLiner/ProjectLiner/FormLiner.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectLiner/ProjectLiner/FormLinerCollection.Designer.cs b/ProjectLiner/ProjectLiner/FormLinerCollection.Designer.cs new file mode 100644 index 0000000..50e79a9 --- /dev/null +++ b/ProjectLiner/ProjectLiner/FormLinerCollection.Designer.cs @@ -0,0 +1,332 @@ +namespace ProjectLiner +{ + partial class FormLinerCollection + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + groupBoxTools = new GroupBox(); + buttonCreateCompany = new Button(); + panelStorage = new Panel(); + buttonCollectionDel = new Button(); + listBoxCollection = new ListBox(); + buttonCollectionAdd = new Button(); + radioButtonList = new RadioButton(); + radioButtonMassive = new RadioButton(); + textBoxCollectionName = new TextBox(); + labelCollectionName = new Label(); + comboBoxSelectorCompany = new ComboBox(); + pictureBox = new PictureBox(); + panelCompanyTools = new Panel(); + button1 = new Button(); + button2 = new Button(); + maskedTextBox1 = new MaskedTextBox(); + button3 = new Button(); + button4 = new Button(); + button5 = new Button(); + groupBoxTools.SuspendLayout(); + panelStorage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit(); + panelCompanyTools.SuspendLayout(); + SuspendLayout(); + // + // groupBoxTools + // + groupBoxTools.Controls.Add(buttonCreateCompany); + groupBoxTools.Controls.Add(panelStorage); + groupBoxTools.Controls.Add(comboBoxSelectorCompany); + groupBoxTools.Dock = DockStyle.Right; + groupBoxTools.Location = new Point(681, 0); + groupBoxTools.Margin = new Padding(2); + groupBoxTools.Name = "groupBoxTools"; + groupBoxTools.Padding = new Padding(2); + groupBoxTools.Size = new Size(176, 648); + groupBoxTools.TabIndex = 0; + groupBoxTools.TabStop = false; + groupBoxTools.Text = "Инструменты"; + // + // buttonCreateCompany + // + buttonCreateCompany.Font = new Font("Segoe UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point); + buttonCreateCompany.Location = new Point(5, 317); + buttonCreateCompany.Name = "buttonCreateCompany"; + buttonCreateCompany.Size = new Size(166, 23); + buttonCreateCompany.TabIndex = 8; + buttonCreateCompany.Text = "Создать компанию"; + buttonCreateCompany.UseVisualStyleBackColor = true; + buttonCreateCompany.Click += ButtonCreateCompany_Click; + // + // panelStorage + // + panelStorage.Controls.Add(buttonCollectionDel); + panelStorage.Controls.Add(listBoxCollection); + 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(2, 28); + panelStorage.Margin = new Padding(2); + panelStorage.Name = "panelStorage"; + panelStorage.Size = new Size(172, 247); + panelStorage.TabIndex = 7; + // + // buttonCollectionDel + // + buttonCollectionDel.Font = new Font("Segoe UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point); + buttonCollectionDel.Location = new Point(3, 212); + buttonCollectionDel.Name = "buttonCollectionDel"; + buttonCollectionDel.Size = new Size(166, 23); + buttonCollectionDel.TabIndex = 6; + buttonCollectionDel.Text = "Удалить Коллекцию"; + buttonCollectionDel.UseVisualStyleBackColor = true; + buttonCollectionDel.Click += ButtonCollectionDel_Click; + // + // listBoxCollection + // + listBoxCollection.Font = new Font("Segoe UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point); + listBoxCollection.FormattingEnabled = true; + listBoxCollection.ItemHeight = 17; + listBoxCollection.Location = new Point(3, 110); + listBoxCollection.Name = "listBoxCollection"; + listBoxCollection.Size = new Size(166, 89); + listBoxCollection.TabIndex = 5; + // + // buttonCollectionAdd + // + buttonCollectionAdd.Font = new Font("Segoe UI", 7.948052F, FontStyle.Regular, GraphicsUnit.Point); + buttonCollectionAdd.Location = new Point(2, 82); + buttonCollectionAdd.Margin = new Padding(2); + buttonCollectionAdd.Name = "buttonCollectionAdd"; + buttonCollectionAdd.Size = new Size(170, 23); + buttonCollectionAdd.TabIndex = 4; + buttonCollectionAdd.Text = "Добавить коллекцию"; + buttonCollectionAdd.UseVisualStyleBackColor = true; + buttonCollectionAdd.Click += ButtonCollectionAdd_Click; + // + // radioButtonList + // + radioButtonList.AutoSize = true; + radioButtonList.Font = new Font("Segoe UI", 9.818182F, FontStyle.Regular, GraphicsUnit.Point); + radioButtonList.Location = new Point(89, 58); + radioButtonList.Margin = new Padding(2); + radioButtonList.Name = "radioButtonList"; + radioButtonList.Size = new Size(73, 23); + radioButtonList.TabIndex = 3; + radioButtonList.TabStop = true; + radioButtonList.Text = "Список"; + radioButtonList.UseVisualStyleBackColor = true; + // + // radioButtonMassive + // + radioButtonMassive.AutoSize = true; + radioButtonMassive.Font = new Font("Segoe UI", 9.818182F, FontStyle.Regular, GraphicsUnit.Point); + radioButtonMassive.Location = new Point(2, 58); + radioButtonMassive.Margin = new Padding(2); + radioButtonMassive.Name = "radioButtonMassive"; + radioButtonMassive.Size = new Size(71, 23); + radioButtonMassive.TabIndex = 2; + radioButtonMassive.TabStop = true; + radioButtonMassive.Text = "массив"; + radioButtonMassive.UseVisualStyleBackColor = true; + // + // textBoxCollectionName + // + textBoxCollectionName.Location = new Point(0, 26); + textBoxCollectionName.Margin = new Padding(2); + textBoxCollectionName.Name = "textBoxCollectionName"; + textBoxCollectionName.Size = new Size(172, 33); + textBoxCollectionName.TabIndex = 1; + // + // labelCollectionName + // + labelCollectionName.AutoSize = true; + labelCollectionName.Font = new Font("Segoe UI", 9.818182F, FontStyle.Regular, GraphicsUnit.Point); + labelCollectionName.Location = new Point(14, 5); + labelCollectionName.Margin = new Padding(2, 0, 2, 0); + labelCollectionName.Name = "labelCollectionName"; + labelCollectionName.Size = new Size(140, 19); + labelCollectionName.TabIndex = 0; + labelCollectionName.Text = "Название коллекции"; + // + // comboBoxSelectorCompany + // + comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxSelectorCompany.FormattingEnabled = true; + comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); + comboBoxSelectorCompany.Location = new Point(13, 279); + comboBoxSelectorCompany.Margin = new Padding(2); + comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; + comboBoxSelectorCompany.Size = new Size(158, 33); + comboBoxSelectorCompany.TabIndex = 0; + comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged; + // + // pictureBox + // + pictureBox.Dock = DockStyle.Bottom; + pictureBox.Enabled = false; + pictureBox.Location = new Point(0, 0); + pictureBox.Margin = new Padding(2); + pictureBox.Name = "pictureBox"; + pictureBox.Size = new Size(681, 648); + pictureBox.TabIndex = 1; + pictureBox.TabStop = false; + // + // panelCompanyTools + // + panelCompanyTools.BackColor = SystemColors.Window; + panelCompanyTools.Controls.Add(button1); + panelCompanyTools.Controls.Add(button2); + panelCompanyTools.Controls.Add(maskedTextBox1); + panelCompanyTools.Controls.Add(button5); + panelCompanyTools.Controls.Add(button3); + panelCompanyTools.Controls.Add(button4); + panelCompanyTools.Location = new Point(681, 346); + panelCompanyTools.Name = "panelCompanyTools"; + panelCompanyTools.Size = new Size(176, 302); + panelCompanyTools.TabIndex = 9; + // + // button1 + // + button1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + button1.Location = new Point(4, 2); + button1.Margin = new Padding(2); + button1.Name = "button1"; + button1.Size = new Size(140, 46); + button1.TabIndex = 1; + button1.Text = "Добавление Лайнера"; + button1.UseVisualStyleBackColor = true; + button1.Click += ButtonAddLiner_Click; + // + // button2 + // + button2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + button2.Location = new Point(2, 52); + button2.Margin = new Padding(2); + button2.Name = "button2"; + button2.Size = new Size(140, 46); + button2.TabIndex = 2; + button2.Text = "Добавление Обычного Лайнера"; + button2.UseVisualStyleBackColor = true; + button2.Click += ButtonAddCommonLiner_Click; + // + // maskedTextBox1 + // + maskedTextBox1.Location = new Point(2, 102); + maskedTextBox1.Margin = new Padding(2); + maskedTextBox1.Mask = "00"; + maskedTextBox1.Name = "maskedTextBox1"; + maskedTextBox1.Size = new Size(142, 33); + maskedTextBox1.TabIndex = 3; + maskedTextBox1.ValidatingType = typeof(int); + // + // button3 + // + button3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + button3.Location = new Point(2, 134); + button3.Margin = new Padding(2); + button3.Name = "button3"; + button3.Size = new Size(140, 46); + button3.TabIndex = 4; + button3.Text = "Удаление Лайнера"; + button3.UseVisualStyleBackColor = true; + button3.Click += ButtonRemoveLiner_Click; + // + // button4 + // + button4.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + button4.Location = new Point(2, 184); + button4.Margin = new Padding(2); + button4.Name = "button4"; + button4.Size = new Size(140, 46); + button4.TabIndex = 5; + button4.Text = "Передать на тесты"; + button4.UseVisualStyleBackColor = true; + button4.Click += ButtonGoToCheck_Click; + // + // button5 + // + button5.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + button5.Location = new Point(2, 234); + button5.Margin = new Padding(2); + button5.Name = "button5"; + button5.Size = new Size(140, 46); + button5.TabIndex = 6; + button5.Text = "Обновить"; + button5.UseVisualStyleBackColor = true; + button5.Click += ButtonRefresh_Click; + // + // FormLinerCollection + // + AutoScaleDimensions = new SizeF(11F, 25F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(857, 648); + Controls.Add(panelCompanyTools); + Controls.Add(pictureBox); + Controls.Add(groupBoxTools); + Margin = new Padding(2); + Name = "FormLinerCollection"; + Text = "Коллекция автомобилей"; + groupBoxTools.ResumeLayout(false); + panelStorage.ResumeLayout(false); + panelStorage.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); + panelCompanyTools.ResumeLayout(false); + panelCompanyTools.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private GroupBox groupBoxTools; + private Button buttonAddLiner; + private ComboBox comboBoxSelectorCompany; + private Button buttonAddCommonLiner; + private PictureBox pictureBox; + private Button buttonGoToCheck; + private Button buttonRemoveLiner; + private MaskedTextBox maskedTextBoxPosition; + private Button buttonRefresh; + private Panel panelStorage; + private Label labelCollectionName; + private RadioButton radioButtonMassive; + private TextBox textBoxCollectionName; + private Button buttonCollectionAdd; + private RadioButton radioButtonList; + private Button buttonCollectionDel; + private ListBox listBoxCollection; + private Button buttonCreateCompany; + private Panel panelCompanyTools; + private Button button1; + private Button button2; + private MaskedTextBox maskedTextBox1; + private Button button5; + private Button button3; + private Button button4; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/FormLinerCollection.cs b/ProjectLiner/ProjectLiner/FormLinerCollection.cs new file mode 100644 index 0000000..67b99b3 --- /dev/null +++ b/ProjectLiner/ProjectLiner/FormLinerCollection.cs @@ -0,0 +1,256 @@ + +using ProjectLiner.CollectionGenericObjects; +using ProjectLiner.Drawnings; + +namespace ProjectLiner; +/// +/// Форма работы с компанией и ее коллекцией +/// +public partial class FormLinerCollection : Form +{ + /// + /// Хранилише коллекций + /// + private readonly StorageCollection _storageCollection; + /// + /// Компания + /// + private AbstractCompany? _company = null; + /// + /// Конструктор + /// + public FormLinerCollection() + { + InitializeComponent(); + _storageCollection = new(); + } + /// + /// Выбор компании + /// + /// + /// + private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e) + { + panelCompanyTools.Enabled = false; + } + /// + /// Добавление грузовика + /// + /// + /// + private void ButtonAddCommonLiner_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningCommonLiner)); + /// + /// Добавление подметательно-уборочной машины + /// + /// + /// + private void ButtonAddLiner_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLiner)); + /// + /// Создание объекта класса-перемещенияв + /// + /// + private void CreateObject(string type) + { + if (_company == null) + { + return; + } + Random random = new(); + DrawningCommonLiner drawningCommonLiner; + switch (type) + { + case nameof(DrawningCommonLiner): + drawningCommonLiner = new DrawningCommonLiner(random.Next(100, 300), + random.Next(1000, 3000), GetColor(random)); + break; + case nameof(DrawningLiner): + drawningCommonLiner = new DrawningLiner(random.Next(100, 300), random.Next(1000, 3000), + GetColor(random), GetColor(random), + Convert.ToBoolean(random.Next(0, 2)), + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); + break; + default: + return; + } + if (_company + drawningCommonLiner != -1) + { + MessageBox.Show("Объект добавлен"); + pictureBox.Image = _company.Show(); + } + else + { + MessageBox.Show("Не удалось добавить объект"); + } + } + /// + /// Получение цвета + /// + /// Генератор случайных чисел + /// + private static Color GetColor(Random random) + { + Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, + 256), random.Next(0, 256)); + ColorDialog dialog = new(); + if (dialog.ShowDialog() == DialogResult.OK) + { + color = dialog.Color; + } + return color; + } + /// + /// Удаление объекта + /// + /// + /// + private void ButtonRemoveLiner_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null) + { + return; + } + if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + { + return; + } + int pos = Convert.ToInt32(maskedTextBoxPosition.Text); + if (_company - pos != null) + { + MessageBox.Show("Объект удален"); + pictureBox.Image = _company.Show(); + } + else + { + MessageBox.Show("Не удалось удалить объект"); + } + + } + /// + /// Передача объекта в другую форму + /// + /// + /// + private void ButtonGoToCheck_Click(object sender, EventArgs e) + { + if (_company == null) + { + return; + } + DrawningCommonLiner? liner = null; + int counter = 100; + while (liner == null) + { + liner = _company.GetRandomObject(); + counter--; + if (counter <= 0) break; + } + if (liner == null) + { + return; + } + FormLiner form = new FormLiner(); + form.SetLiner = liner; + form.ShowDialog(); + } + /// + /// Перерисовка коллекции + /// + /// + /// + private void ButtonRefresh_Click(object sender, EventArgs e) + { + if (_company == null) + { + return; + } + + pictureBox.Image = _company.Show(); + + } + /// + /// Добавление коллекции + /// + /// + /// + private void ButtonCollectionAdd_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMassive.Checked)) + { + MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + CollectionType collectionType = CollectionType.None; + if (radioButtonMassive.Checked) + { + collectionType = CollectionType.Massive; + } + else if (radioButtonList.Checked) + { + collectionType = CollectionType.List; + } + _storageCollection.AddCollection(textBoxCollectionName.Text, collectionType); + RerfreshListBoxItems(); + } + /// + /// Удаление коллекции + /// + /// + /// + private void ButtonCollectionDel_Click(object sender, EventArgs e) + { + if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null) + { + MessageBox.Show("Коллекция не выбрана"); + return; + } + if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + _storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString()); + RerfreshListBoxItems(); + } + /// + /// Обновление списка в listBoxCollection + /// + private void RerfreshListBoxItems() + { + listBoxCollection.Items.Clear(); + for (int i = 0; i < _storageCollection.Keys?.Count; ++i) + { + string? colName = _storageCollection.Keys?[i]; + if (!string.IsNullOrEmpty(colName)) + { + listBoxCollection.Items.Add(colName); + } + } + } + /// + /// Создание компании + /// + /// + /// + private void ButtonCreateCompany_Click(object sender, EventArgs e) + { + if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null) + { + MessageBox.Show("Коллекция не выбрана"); + return; + } + ICollectionGenericObjects? collection = + _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty]; + if (collection == null) + { + MessageBox.Show("Коллекция не проинициализирована"); + return; + } + switch (comboBoxSelectorCompany.Text) + { + case "Хранилище": + _company = new LinerSharingService(pictureBox.Width, pictureBox.Height, collection); + break; + } + panelCompanyTools.Enabled = true; + RerfreshListBoxItems(); + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/FormLinerCollection.resx b/ProjectLiner/ProjectLiner/FormLinerCollection.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectLiner/ProjectLiner/FormLinerCollection.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/AbstractStrategy.cs b/ProjectLiner/ProjectLiner/MovementStrategy/AbstractStrategy.cs new file mode 100644 index 0000000..ca37c66 --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/AbstractStrategy.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; +/// +/// Класс-стратегия перемещения объекта +/// +public abstract class AbstractStrategy +{ + /// + /// Перемещаемый объект + /// + private IMoveableObject? _moveableObject; + + /// + /// Статус перемещения + /// + private StrategyStatus _state = StrategyStatus.NotInit; + + /// + /// Ширина поля + /// + protected int FieldWidth { get; private set; } + + /// + /// Высота поля + /// + protected int FieldHeight { get; private set; } + + /// + /// Статус перемещения + /// + /// + public StrategyStatus GetStatus() { return _state; } + + /// + /// Установка данных + /// + /// Перемещаемый объект + /// Ширина поля + /// Высота поля + public void SetData(IMoveableObject moveableObject, int width, int height) + { + if (moveableObject == null) + { + _state = StrategyStatus.NotInit; + return; + } + + _state = StrategyStatus.InProgress; + _moveableObject = moveableObject; + FieldWidth = width; + FieldHeight = height; + } + + /// + /// Шаг перемещения + /// + public void MakeStep() + { + if (_state != StrategyStatus.InProgress) + { + return; + } + + if (IsTargetDestination()) + { + _state = StrategyStatus.Finish; + return; + } + + MoveToTarget(); + } + + /// + /// Перемещение влево + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveLeft() => MoveTo(MovementDirection.Left); + + /// + /// Перемещение вправо + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveRight() => MoveTo(MovementDirection.Right); + + /// + /// Перемещение вверх + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveUp() => MoveTo(MovementDirection.Up); + + /// + /// Перемещение вниз + /// + /// Результат перемещения (true - удалось переместиться, false - неудача) + protected bool MoveDown() => MoveTo(MovementDirection.Down); + + /// + /// Параметры объекта + /// + protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition; + + /// + /// Шаг объекта + /// + /// + protected int? GetStep() + { + if (_state != StrategyStatus.InProgress) + { + return null; + } + return _moveableObject?.GetStep; + } + + /// + /// Перемещение к цели + /// + protected abstract void MoveToTarget(); + + /// + /// Достигнута ли цель + /// + /// + protected abstract bool IsTargetDestination(); + + /// + /// Попытка перемещения в требуемом направлении + /// + /// Направление + /// Результат попытки (true - удалось, false - неудача) + private bool MoveTo(MovementDirection movementDirection) + { + if (_state != StrategyStatus.InProgress) + { + return false; + } + + return _moveableObject?.TryMoveObject(movementDirection) ?? false; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/IMoveableObjectcs.cs b/ProjectLiner/ProjectLiner/MovementStrategy/IMoveableObjectcs.cs new file mode 100644 index 0000000..e2b5686 --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/IMoveableObjectcs.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; + +/// +/// Интерфейс для работы с перемещаемым объектом +/// +public interface IMoveableObject +{ + /// + /// Получение координаты объекта + /// + ObjectParameters? GetObjectPosition { get; } + + int AnotherStep { set; } + + /// + /// Шаг объекта + /// + int GetStep { get; } + + /// + /// Попытка переместить объект в указанном направлении + /// + /// Направление + /// true - объект перемещен, false - перемещение невозможно + bool TryMoveObject(MovementDirection direction); + + + /// + /// ненужный метод + /// + /// Первое число + + void MegaTurboStep(int value); +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/MoveToBorder.cs b/ProjectLiner/ProjectLiner/MovementStrategy/MoveToBorder.cs new file mode 100644 index 0000000..37eced3 --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/MoveToBorder.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; + +/// +/// Стратегия перемещения объекта к правой нижней границы +/// +public class MoveToBorder : AbstractStrategy +{ + protected override bool IsTargetDestination() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + + return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth && + objParams.DownBorder <= FieldHeight && objParams.DownBorder + GetStep() >= FieldHeight; + } + + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + int diffX = objParams.RightBorder - FieldWidth; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + int diffY = objParams.DownBorder - FieldHeight; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + } + } +} diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/MoveToCenter.cs b/ProjectLiner/ProjectLiner/MovementStrategy/MoveToCenter.cs new file mode 100644 index 0000000..afe820c --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/MoveToCenter.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; + +/// +/// Стратегия перемещения объекта в центр экрана +/// +public class MoveToCenter : AbstractStrategy +{ + protected override bool IsTargetDestination() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return false; + } + + return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && + objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; + } + + protected override void MoveToTarget() + { + ObjectParameters? objParams = GetObjectParameters; + if (objParams == null) + { + return; + } + + int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2; + if (Math.Abs(diffX) > GetStep()) + { + if (diffX > 0) + { + MoveLeft(); + } + else + { + MoveRight(); + } + } + + int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; + if (Math.Abs(diffY) > GetStep()) + { + if (diffY > 0) + { + MoveUp(); + } + else + { + MoveDown(); + } + } + } +} diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/MoveableLiner.cs b/ProjectLiner/ProjectLiner/MovementStrategy/MoveableLiner.cs new file mode 100644 index 0000000..b067010 --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/MoveableLiner.cs @@ -0,0 +1,82 @@ +using ProjectLiner.Drawnings; +using ProjectLiner.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; + +/// +/// Класс-реализация IMoveableObject с использованием DrawningCommonLiner +/// +public class MoveableLiner : IMoveableObject +{ + /// + /// Поле-объект класса DrawningCommonLiner или его наследника + /// + private readonly DrawningCommonLiner? _CommonLiner = null; + + /// + /// Конструктор + /// + /// Объект класса DrawningCommonLiner + public MoveableLiner(DrawningCommonLiner CommonLiner) + { + _CommonLiner = CommonLiner; + } + + public ObjectParameters? GetObjectPosition + { + get + { + if (_CommonLiner == null || _CommonLiner.EntityCommonLiner == null || !_CommonLiner.GetPosX.HasValue || !_CommonLiner.GetPosY.HasValue) + { + return null; + } + return new ObjectParameters(_CommonLiner.GetPosX.Value, _CommonLiner.GetPosY.Value, _CommonLiner.GetWidth, _CommonLiner.GetHeight); + } + } + + public int GetStep => (int)(_CommonLiner?.EntityCommonLiner?.Step ?? 0); + + public int AnotherStep + { + set + { + AnotherStep = value; + } + } + + public bool TryMoveObject(MovementDirection direction) + { + if (_CommonLiner == null || _CommonLiner.EntityCommonLiner == null) + { + return false; + } + return _CommonLiner.MoveTransport(GetDirectionType(direction)); + } + + /// + /// Конвертация из MovementDirection в DirectionType + /// + /// MovementDirection + /// DirectionType + private static DirectionType GetDirectionType(MovementDirection direction) + { + return direction switch + { + MovementDirection.Left => DirectionType.Left, + MovementDirection.Right => DirectionType.Right, + MovementDirection.Up => DirectionType.Up, + MovementDirection.Down => DirectionType.Down, + _ => DirectionType.Unknow, + }; + } + + public void MegaTurboStep(int value) + { + AnotherStep = value; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/MovementDirection.cs b/ProjectLiner/ProjectLiner/MovementStrategy/MovementDirection.cs new file mode 100644 index 0000000..3981ef6 --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/MovementDirection.cs @@ -0,0 +1,30 @@ +namespace ProjectLiner.MovementStrategy; + + + +/// +/// Направление перемещения +/// +public enum MovementDirection +{ + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 +} + diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/ObjectParameters.cs b/ProjectLiner/ProjectLiner/MovementStrategy/ObjectParameters.cs new file mode 100644 index 0000000..251aa9a --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/ObjectParameters.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; + +/// +/// Параметры-координаты объекта +/// +public class ObjectParameters +{ + /// + /// Координата X + /// + private readonly int _x; + + /// + /// Координата Y + /// + private readonly int _y; + + /// + /// Ширина объекта + /// + private readonly int _width; + + /// + /// Высота объекта + /// + private readonly int _height; + + /// + /// Левая граница + /// + public int LeftBorder => _x; + + /// + /// Верхняя граница + /// + public int TopBorder => _y; + + /// + /// Правая граница + /// + public int RightBorder => _x + _width; + + /// + /// Нижняя граница + /// + public int DownBorder => _y + _height; + + /// + /// Середина объекта + /// + public int ObjectMiddleHorizontal => _x + _width / 2; + + /// + /// Середина объекта + /// + public int ObjectMiddleVertical => _y + _height / 2; + + /// + /// конструктор + /// + /// Координата X + /// Координата Y + /// Ширина объекта + /// Высота объекта + public ObjectParameters(int x, int y, int width, int height) + { + _x = x; + _y = y; + _width = width; + _height = height; + } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/MovementStrategy/StrategyStatus.cs b/ProjectLiner/ProjectLiner/MovementStrategy/StrategyStatus.cs new file mode 100644 index 0000000..b221f83 --- /dev/null +++ b/ProjectLiner/ProjectLiner/MovementStrategy/StrategyStatus.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectLiner.MovementStrategy; +/// +/// Статус выполнения операции перемещения +/// +public enum StrategyStatus +{ + /// + /// Все готово к началу + /// + NotInit, + + /// + /// Выполняется + /// + InProgress, + + /// + /// Завершено + /// + Finish +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Program.cs b/ProjectLiner/ProjectLiner/Program.cs index 6a14f7d..e3f64ca 100644 --- a/ProjectLiner/ProjectLiner/Program.cs +++ b/ProjectLiner/ProjectLiner/Program.cs @@ -11,7 +11,7 @@ namespace ProjectLiner // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(new FormLinerCollection()); } } } \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/ProjectLiner.csproj b/ProjectLiner/ProjectLiner/ProjectLiner.csproj index e1a0735..244387d 100644 --- a/ProjectLiner/ProjectLiner/ProjectLiner.csproj +++ b/ProjectLiner/ProjectLiner/ProjectLiner.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Properties/Resources.Designer.cs b/ProjectLiner/ProjectLiner/Properties/Resources.Designer.cs new file mode 100644 index 0000000..478d0e0 --- /dev/null +++ b/ProjectLiner/ProjectLiner/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectLiner.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом StronglyTypedResourceBuilder + // с помощью такого средства, как ResGen или Visual Studio. + // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen + // с параметром /str или перестройте свой проект VS. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectLiner.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap bottom { + get { + object obj = ResourceManager.GetObject("bottom", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap left { + get { + object obj = ResourceManager.GetObject("left", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap right { + get { + object obj = ResourceManager.GetObject("right", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap top { + get { + object obj = ResourceManager.GetObject("top", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectLiner/ProjectLiner/Properties/Resources.resx b/ProjectLiner/ProjectLiner/Properties/Resources.resx new file mode 100644 index 0000000..b1de66a --- /dev/null +++ b/ProjectLiner/ProjectLiner/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\bottom.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\top.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Resources/bottom.png b/ProjectLiner/ProjectLiner/Resources/bottom.png new file mode 100644 index 0000000..504bf06 Binary files /dev/null and b/ProjectLiner/ProjectLiner/Resources/bottom.png differ diff --git a/ProjectLiner/ProjectLiner/Resources/left.png b/ProjectLiner/ProjectLiner/Resources/left.png new file mode 100644 index 0000000..2ac2a79 Binary files /dev/null and b/ProjectLiner/ProjectLiner/Resources/left.png differ diff --git a/ProjectLiner/ProjectLiner/Resources/right.png b/ProjectLiner/ProjectLiner/Resources/right.png new file mode 100644 index 0000000..f97b115 Binary files /dev/null and b/ProjectLiner/ProjectLiner/Resources/right.png differ diff --git a/ProjectLiner/ProjectLiner/Resources/top.png b/ProjectLiner/ProjectLiner/Resources/top.png new file mode 100644 index 0000000..cec057e Binary files /dev/null and b/ProjectLiner/ProjectLiner/Resources/top.png differ