Compare commits

...

7 Commits

39 changed files with 2498 additions and 75 deletions

View File

@ -0,0 +1,104 @@
using AntiAircraftGun.Drawnings;
namespace AntiAircraftGun.CollectionGenericObjects;
public abstract class AbstractCompany
{
/// <summary>
/// Размер места (ширина)
/// </summary>
protected readonly int _placeSizeWidth = 210;
/// <summary>
/// Размер места (высота)
/// </summary>
protected readonly int _placeSizeHeight = 130;
/// <summary>
/// Ширина окна
/// </summary>
protected readonly int _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
protected readonly int _pictureHeight;
/// <summary>
/// Коллекция установок
/// </summary>
protected ICollectionGenericObjects<DrawningGun>? _collection = null;
/// <summary>
/// Вычисление максимального количества элементов, который можно разместить в окне
/// </summary>
private int GetMaxCount => _pictureWidth * _pictureHeight /
(_placeSizeWidth * _placeSizeHeight);
/// <summary>
/// Конструктор
/// </summary>
/// <param name="picWidth">Ширина окна</param>
/// <param name="picHeight">Высота окна</param>
/// <param name="collection">Коллекция утановок</param>
public AbstractCompany(int picWidth, int picHeight,
ICollectionGenericObjects<DrawningGun> collection)
{
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = collection;
_collection.SetMaxCount = GetMaxCount;
}
/// <summary>
/// Перегрузка оператора сложения для класса
/// </summary>
/// <param name="company">Компания</param>
/// <param name="gun">Добавляемый объект</param>
/// <returns></returns>
public static bool operator +(AbstractCompany company, DrawningGun gun)
{
return company._collection?.Insert(gun) ?? false;
}
/// <summary>
/// Перегрузка оператора удаления для класса
/// </summary>
/// <param name="company">Компания</param>
/// <param name="position">Номер удаляемого объекта</param>
/// <returns></returns>
public static bool operator -(AbstractCompany company, int position)
{
return company._collection?.Remove(position) ?? false;
}
/// <summary>
/// Получение случайного объекта из коллекции
/// </summary>
/// <returns></returns>
public DrawningGun? GetRandomObject()
{
Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount));
}
/// <summary>
/// Вывод всей коллекции
/// </summary>
/// <returns></returns>
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)
{
DrawningGun? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
}
return bitmap;
}
/// <summary>
/// Вывод заднего фона
/// </summary>
/// <param name="g"></param>
protected abstract void DrawBackgound(Graphics g);
/// <summary>
/// Расстановка объектов
/// </summary>
protected abstract void SetObjectsPosition();
}

View File

@ -0,0 +1,19 @@
namespace AntiAircraftGun.CollectionGenericObjects;
/// <summary>
/// Тип коллекции
/// </summary>
public enum CollectionType
{
/// <summary>
/// Неопределено
/// </summary>
None = 0,
/// <summary>
/// Массив
/// </summary>
Massive = 1,
/// <summary>
/// Список
/// </summary>
List = 2
}

View File

@ -0,0 +1,63 @@
using AntiAircraftGun.Drawnings;
namespace AntiAircraftGun.CollectionGenericObjects;
/// <summary>
/// Класс, отвечающий за базу
/// </summary>
public class GunSharingService : AbstractCompany
{
public GunSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningGun> collection) : base(picWidth, picHeight, collection)
{
}
private int offsetX = 30;
/// <summary>
/// Отрисовка базы
/// </summary>
/// <param name="g">Графика</param>
protected override void DrawBackgound(Graphics g)
{
Pen pen = new Pen(Color.Black, 4);
int maxCountX = (_pictureWidth / _placeSizeWidth);
int maxCountY = (_pictureHeight / _placeSizeHeight);
for (int i = 0; i < maxCountX; i++)
{
for (int j = 0; j < maxCountY; j++)
{
g.DrawLine(pen, i * offsetX + i * _placeSizeWidth, j * _placeSizeHeight, _placeSizeWidth + i * offsetX + i * _placeSizeWidth, j * _placeSizeHeight);
g.DrawLine(pen, i * offsetX + i * _placeSizeWidth, j * _placeSizeHeight, i * offsetX + i * _placeSizeWidth, _placeSizeHeight + j * _placeSizeHeight);
g.DrawLine(pen, i * offsetX + i * _placeSizeWidth, _placeSizeHeight + j * _placeSizeHeight, _placeSizeWidth + i * offsetX + i * _placeSizeWidth, _placeSizeHeight + j * _placeSizeHeight);
}
}
}
/// <summary>
/// Установка объекта в базу
/// </summary>
protected override void SetObjectsPosition()
{
int maxCountX = _pictureWidth / _placeSizeWidth;
int maxCountY = _pictureHeight / _placeSizeHeight;
int boarderOffsetX = 10;
int boarderOffsetY = 10;
int currentIndex = -1;
for (int j = 0; j < maxCountY; j++)
{
for (int i = 0; i < maxCountX; i++)
{
currentIndex++;
if (_collection.Get(currentIndex) != null)
{
_collection.Get(currentIndex).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(currentIndex).SetPosition(boarderOffsetX + i * _placeSizeWidth + i * offsetX, boarderOffsetY + j * _placeSizeHeight);
}
}
}
}
}

View File

@ -0,0 +1,45 @@
namespace AntiAircraftGun.CollectionGenericObjects;
/// <summary>
/// Интерфейс описания действий для набора хранимых объектов
/// </summary>
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
public interface ICollectionGenericObjects<T>
where T : class
{
/// <summary>
/// Количество объектов в коллекции
/// </summary>
int Count { get; }
/// <summary>
/// Установка максимального количества элементов
/// </summary>
int SetMaxCount { set; }
/// <summary>
/// Добавление объекта в коллекцию
/// </summary>
/// <param name="obj">Добавляемый объект</param>
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
bool Insert(T obj);
/// <summary>
/// Добавление объекта в коллекцию на конкретную позицию
/// </summary>
/// <param name="obj">Добавляемый объект</param>
/// <param name="position">Позиция</param>
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
bool Insert(T obj, int position);
/// <summary>
/// Удаление объекта из коллекции с конкретной позиции
/// </summary>
/// <param name="position">Позиция</param>
/// <returns>true - удаление прошло удачно, false - удаление не удалось</returns>
bool Remove(int position);
/// <summary>
/// Получение объекта по позиции
/// </summary>
/// <param name="position">Позиция</param>
/// <returns>Объект</returns>
T? Get(int position);
}

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.CollectionGenericObjects;
/// <summary>
/// Параметризованный набор объектов
/// </summary>
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
public class ListGenericObjects<T> : ICollectionGenericObjects<T>
where T : class
{
/// <summary>
/// Список объектов, которые храним
/// </summary>
private readonly List<T?> _collection;
/// <summary>
/// Максимально допустимое число объектов в списке
/// </summary>
private int _maxCount;
public int Count => _collection.Count;
public int SetMaxCount { set { if (value > 0) { _maxCount = value; } } }
/// <summary>
/// Конструктор
/// </summary>
public ListGenericObjects()
{
_collection = new();
}
public T? Get(int position)
{
// TODO проверка позиции
if (!_collection.Any()) { return null; }
if (_collection.Count <= position || position < 0 || position >= _maxCount) { return null; }
return _collection[position];
}
public bool Insert(T obj)
{
// TODO проверка, что не превышено максимальное количество элементов
// TODO вставка в конец набора
if (_collection.Count>=_maxCount) return false;
_collection.Add(obj);
return true;
}
public bool Insert(T obj, int position)
{
// TODO проверка, что не превышено максимальное количество элементов
// TODO проверка позиции
// TODO вставка по позиции
if (_collection.Count >= _maxCount || _collection[position] == null || position < 0) { return false; }
_collection.Insert(position, obj);
return true;
}
public bool Remove(int position)
{
// TODO проверка позиции
// TODO удаление объекта из списка
if (_collection[position] == null)
{
return false;
}
_collection.RemoveAt(position);
return true;
}
}

View File

@ -0,0 +1,101 @@
using System.Diagnostics;
namespace AntiAircraftGun.CollectionGenericObjects;
/// <summary>
/// Параметризованный набор объектов
/// </summary>
/// <typeparam name="T">Параметр: ограничение - ссылочный тип</typeparam>
internal class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
where T : class
{
/// <summary>
/// Массив объектов, которые храним
/// </summary>
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];
}
}
}
}
/// <summary>
/// Конструктор
/// </summary>
public MassiveGenericObjects()
{
_collection = Array.Empty<T?>();
}
public T? Get(int position)
{
// TODO проверка позиции
if (_collection[position] == null)
return null;
return _collection[position];
}
public bool Insert(T obj)
{
// TODO вставка в свободное место набора
for (int i = 0; i < Count; i++)
{
if (InsertingElementCollection(i, obj)) return true;
}
return false;
}
public bool Insert(T obj, int position)
{
// TODO проверка позиции
// TODO проверка, что элемент массива по этой позиции пустой, если нет, то
// ищется свободное место после этой позиции и идет вставка туда
// если нет после, ищем до
// TODO вставка
if (InsertingElementCollection(position, obj)) return true;
for (int i = position + 1; i < Count; i++)
{
if (InsertingElementCollection(i, obj)) return true;
}
for (int i = position - 1; i >= 0; i--)
{
if (InsertingElementCollection(i, obj)) return true;
}
return false;
}
public bool Remove(int position)
{
// TODO проверка позиции
// TODO удаление объекта из массива, присвоив элементу массива значение null
if (_collection[position] == null) return false;
_collection[position] = null;
return true;
}
/// <summary>
/// Если элемент массива пустой, то вставляем новый элемент
/// </summary>
/// <param name="index">Индекс элемента</param>
/// <param name="obj">Элемент</param>
/// <returns>false - элемент массива != null, true - = null</returns>
private bool InsertingElementCollection(int index, T obj)
{
if (_collection[index] != null) return false;
_collection[index] = obj;
return true;
}
}

View File

@ -0,0 +1,73 @@
namespace AntiAircraftGun.CollectionGenericObjects;
/// <summary>
/// Класс-хранилище коллекций
/// </summary>
/// <typeparam name="T"></typeparam>
public class StorageCollection<T>
where T : class
{
/// <summary>
/// Словарь (хранилище) с коллекциями
/// </summary>
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
/// <summary>
/// Возвращение списка названий коллекций
/// </summary>
public List<string> Keys => _storages.Keys.ToList();
/// <summary>
/// Конструктор
/// </summary>
public StorageCollection()
{
_storages = new Dictionary<string, ICollectionGenericObjects<T>>();
}
/// <summary>
/// Добавление коллекции в хранилище
/// </summary>
/// <param name="name">Название коллекции</param>
/// <param name="collectionType">тип коллекции</param>
public void AddCollection(string name, CollectionType collectionType)
{
// TODO проверка, что name не пустой и нет в словаре записи с таким ключом
// TODO Прописать логику для добавления
if (name.Length<=0 || _storages.ContainsKey(name))
{
return;
}
switch(collectionType)
{
case CollectionType.List:
_storages.Add(name, new ListGenericObjects<T>());
break;
case CollectionType.Massive:
_storages.Add(name, new MassiveGenericObjects<T>());
break;
default:
return;
}
}
/// <summary>
/// Удаление коллекции
/// </summary>
/// <param name="name">Название коллекции</param>
public void DelCollection(string name)
{
// TODO Прописать логику для удаления коллекции
if(!_storages.ContainsKey(name)) { return; }
_storages.Remove(name);
}
/// <summary>
/// Доступ к коллекции
/// </summary>
/// <param name="name">Название коллекции</param>
/// <returns></returns>
public ICollectionGenericObjects<T>? this[string name]
{
get
{
// TODO Продумать логику получения объекта
if (!_storages.ContainsKey(name)) { return null; }
return _storages[name];
}
}
}

View File

@ -0,0 +1,27 @@
namespace AntiAircraftGun.Drawnings;
/// <summary>
/// Направление перемещения
/// </summary>
public enum DirectionType
{
/// <summary>
/// Вверх
/// </summary>
Up = 1,
/// <summary>
/// Вниз
/// </summary>
Down = 2,
/// <summary>
/// Влево
/// </summary>
Left = 3,
/// <summary>
/// Вправо
/// </summary>
Right = 4,
/// <summary>
/// Неизвестно направление
/// </summary>
Unknow = -1
}

View File

@ -0,0 +1,57 @@
using AntiAircraftGun.Entities;
namespace AntiAircraftGun.Drawnings;
/// <summary>
/// Класс, отвечающий за прорисовку и перемещение объекта
/// </summary>
public class DrawningAntiAircraftGun:DrawningGun
{
/// <summary>
/// Конструктор
/// </summary>
/// <param name="speed"></param>
/// <param name="weight"></param>
/// <param name="bodyColor"></param>
/// <param name="optionalElementsColor"></param>
/// <param name="barrelLenth"></param>
/// <param name="hatchHeight"></param>
public DrawningAntiAircraftGun(int speed, double weight, Color bodyColor, Color optionalElementsColor, double barrelLenth, bool hatchHeight, bool radar) : base(150,115) //140, 65
{
EntityGun = new EntityAntiAircraftGun(speed,weight,bodyColor,optionalElementsColor,barrelLenth,hatchHeight,radar);
}
/// <summary>
/// Прорисовка объекта
/// </summary>
/// <param name="g"></param>
public override void DrawTransport(Graphics g)
{
_startPosX += 10;
_startPosY += 50;
base.DrawTransport(g);
_startPosX -= 10;
_startPosY -= 50;
if (EntityGun == null || !_startPosX.HasValue || !_startPosY.HasValue || EntityGun is not EntityAntiAircraftGun antiAircraftGun) return;
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(antiAircraftGun.OptionalElementsColor);
// Орудие
Pen penWeapon = new Pen(Color.Black, 8);
g.DrawLine(penWeapon, _startPosX.Value + 100, _startPosY.Value + 70, _startPosX.Value + 150, _startPosY.Value + 10);
// Люк
if (antiAircraftGun.Hatch)
{
Random random = new();
g.FillRectangle(additionalBrush, _startPosX.Value + 85, _startPosY.Value + 45, 20, 5);
}
// Радар
if (antiAircraftGun.Radar)
{
Pen penRadar = new Pen(Color.Green, 3);
Brush brushRadar = new SolidBrush(Color.Black);
g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value + 50, _startPosX.Value + 65, _startPosY.Value + 25);
g.FillEllipse(brushRadar, _startPosX.Value + 35, _startPosY.Value, 60, 25);
g.DrawLine(penRadar, _startPosX.Value + 65, _startPosY.Value + 25, _startPosX.Value + 65, _startPosY.Value);
g.DrawLine(penRadar, _startPosX.Value + 35, _startPosY.Value + 13, _startPosX.Value + 95, _startPosY.Value + 13);
}
}
}

View File

@ -0,0 +1,226 @@
using AntiAircraftGun.Entities;
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.Drawnings;
public class DrawningGun
{
/// <summary>
/// Класс-сущность
/// </summary>
public EntityGun? EntityGun { get; protected set; }
/// <summary>
/// Ширина окна
/// </summary>
private int? _pictureWidth;
public int? GetPictureWidth() => _pictureWidth;
/// <summary>
/// Высота окна
/// </summary>
private int? _pictureHeight;
public int? GetPictureHeight() => _pictureHeight;
/// <summary>
/// Левая координата прорисовки зенитной установки
/// </summary>
protected int? _startPosX;
/// <summary>
/// Правая координата прорисовку зенитной установки
/// </summary>
protected int? _startPosY;
/// <summary>
/// Ширина прорисовки зенитной установки
/// </summary>
private readonly int _drawningGunWidth = 140;
/// <summary>
/// Высота прорисовки зенитной установки
/// </summary>
private readonly int _drawingGunHeight = 65;
/// <summary>
/// Координата Х объекта
/// </summary>
public int? GetPosX ()=> _startPosX;
/// <summary>
/// Координата Y объекта
/// </summary>
public int? GetPosY() => _startPosY;
/// <summary>
/// Ширина объекта
/// </summary>
public int GetWidth() => _drawningGunWidth;
/// <summary>
/// Высота объекта
/// </summary>
public int GetHeight() => _drawingGunHeight;
/// <summary>
/// Пустой конструктор
/// </summary>
private DrawningGun()
{
_pictureWidth = null;
_pictureHeight = null;
_startPosX = null;
_startPosY = null;
}
/// <summary>
/// Констурктор
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес</param>
/// <param name="bodyColor">Основной цвет</param>
public DrawningGun(int speed, double weight, Color bodyColor):this()
{
EntityGun = new EntityGun(speed, weight, bodyColor);
}
/// <summary>
/// Конструктор для наследников
/// </summary>
/// <param name="drawningGunWidth">Ширина прорисовки ракетной установки</param>
/// <param name="drawningGunHeight">Высота прорисовки ракетной установки</param>
protected DrawningGun(int drawningGunWidth, int drawningGunHeight):this()
{
_drawingGunHeight = drawningGunHeight;
_drawningGunWidth = drawningGunWidth;
}
/// <summary>
/// Установка гранц поля
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
public bool SetPictureSize(int width, int height)
{
// TODO проверка, что объект "влезает" в размеры поля
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена
if (_drawningGunWidth > width || _drawingGunHeight > height) { return false; }
if (_startPosX.HasValue && _startPosY.HasValue)
{
if (_startPosX.Value + _drawningGunWidth > width)
{
_startPosX = width - _drawningGunWidth;
}
if (_startPosY.Value + _drawingGunHeight > height)
{
_startPosY = height - _drawingGunHeight;
}
}
_pictureHeight = height;
_pictureWidth = width;
return true;
}
/// <summary>
/// Установка позиции
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public void SetPosition(int x, int y)
{
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
{
return;
}
if (x + _drawningGunWidth > _pictureWidth.Value )
{
_startPosX = x - (x + _drawningGunWidth - _pictureWidth.Value);
}else if (x < 0)
{
_startPosX = 0;
}
else
{
_startPosX = x;
}
if (y + _drawingGunHeight > _pictureHeight.Value )
{
_startPosY = y - (y + _drawingGunHeight - _pictureHeight.Value);
}
else if (y < 0)
{
_startPosY = 0;
}
else
{
_startPosY = y;
}
}
/// <summary>
/// Изменение напаравления перемещения
/// </summary>
/// <param name="direction"></param>
/// <returns></returns>
public bool MoveTransport(DirectionType direction)
{
if (EntityGun == null || !_startPosX.HasValue ||
!_startPosY.HasValue)
{
return false;
}
switch (direction)
{
//влево
case DirectionType.Left:
if (_startPosX.Value - EntityGun.Step > 0)
{
_startPosX -= (int)EntityGun.Step;
}
return true;
//вверх
case DirectionType.Up:
if (_startPosY.Value - EntityGun.Step > 0)
{
_startPosY -= (int)EntityGun.Step;
}
return true;
// вправо
case DirectionType.Right:
//TODO прописать логику сдвига в право
if (_startPosX.Value + EntityGun.Step + _drawningGunWidth < _pictureWidth)
{
_startPosX += (int)EntityGun.Step;
}
return true;
//вниз
case DirectionType.Down:
//TODO прописать логику сдвига в вниз
if (_startPosY.Value + EntityGun.Step + _drawingGunHeight < _pictureHeight)
{
_startPosY += (int)EntityGun.Step;
}
return true;
default:
return false;
}
}
/// <summary>
/// Прорисовка объекта
/// </summary>
/// <param name="g"></param>
public virtual void DrawTransport(Graphics g)
{
if (EntityGun == null || !_startPosX.HasValue || !_startPosY.HasValue) return;
Pen pen = new(Color.Black);
Brush MainBrush = new SolidBrush(EntityGun.BodyColor);
// Башня
g.FillRectangle(MainBrush, _startPosX.Value + 50 - 10, _startPosY.Value + 50 - 50, 60, 25);
g.FillRectangle(MainBrush, _startPosX.Value + 25 - 10, _startPosY.Value + 75 - 50, 110, 10);
// Гусеницы
g.DrawArc(pen, _startPosX.Value + 110 - 10, _startPosY.Value + 85 - 50, 40, 30, 270, 180);
g.DrawArc(pen, _startPosX.Value + 10 - 10, _startPosY.Value + 85 - 50, 40, 30, 90, 180);
g.DrawLine(pen, _startPosX.Value + 30 - 10, _startPosY.Value + 115 - 50, _startPosX.Value + 130 - 10, _startPosY.Value + 115 - 50);
// Катки большие
g.DrawEllipse(pen, _startPosX.Value + 13 - 10, _startPosY.Value + 93 - 50, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 126 - 10, _startPosY.Value + 93 - 50, 20, 20);
// Катки малые
g.DrawEllipse(pen, _startPosX.Value + 40 - 10, _startPosY.Value + 105 - 50, 10, 10);
g.DrawEllipse(pen, _startPosX.Value + 60 - 10, _startPosY.Value + 105 - 50, 10, 10);
g.DrawEllipse(pen, _startPosX.Value + 80 - 10, _startPosY.Value + 105 - 50, 10, 10);
g.DrawEllipse(pen, _startPosX.Value + 100 - 10, _startPosY.Value + 105 - 50, 10, 10);
}
}

View File

@ -0,0 +1,30 @@
namespace AntiAircraftGun.Entities;
/// <summary>
/// Класс-сущность "Зенитная установка"
/// </summary>
public class EntityAntiAircraftGun:EntityGun
{
private EntityGun? EntityGun;
public Color OptionalElementsColor { get; private set; }
/// <summary>
/// Длинна ствола
/// </summary>
public double BarrelLength { get; private set; }
/// <summary>
/// Люк
/// </summary>
public bool Hatch { get; private set; }
/// <summary>
/// Радар
/// </summary>
public bool Radar { get; private set; }
public EntityAntiAircraftGun(int speed, double weight, Color bodyColor, Color optionalElementsColor, double barrelLenth, bool hatch, bool radar) : base(speed, weight, bodyColor)
{
EntityGun = new EntityGun(speed, weight, bodyColor);
OptionalElementsColor = optionalElementsColor;
BarrelLength = barrelLenth;
Radar = radar;
Hatch = hatch;
}
}

View File

@ -0,0 +1,35 @@
namespace AntiAircraftGun.Entities;
/// <summary>
/// Класс-сущности "Орудие"
/// </summary>
public class EntityGun
{
/// <summary>
/// Скорость
/// </summary>
public int Speed { get; private set; }
/// <summary>
/// Вес
/// </summary>
public double Weight { get; private set; }
/// <summary>
/// Основной цвет
/// </summary>
public Color BodyColor { get; private set; }
/// <summary>
/// Шаг
/// </summary>
public double Step { get { return Speed * 100 / Weight; } private set { } }
/// <summary>
/// Конструктор сущности
/// </summary>
/// <param name="speed"></param>
/// <param name="weight"></param>
/// <param name="bodyColor"></param>
public EntityGun(int speed, double weight, Color bodyColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
}
}

View File

@ -1,39 +0,0 @@
namespace AntiAircraftGun
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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
}
}

View File

@ -1,10 +0,0 @@
namespace AntiAircraftGun
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,147 @@
namespace AntiAircraftGun
{
partial class FormAntiAircraftGun
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
pictureBoxAntiAircraftGun = new PictureBox();
buttonDown = new Button();
buttonLeft = new Button();
buttonUp = new Button();
buttonRight = new Button();
comboBoxStrategy = new ComboBox();
buttonStrategyStep = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxAntiAircraftGun).BeginInit();
SuspendLayout();
//
// pictureBoxAntiAircraftGun
//
pictureBoxAntiAircraftGun.Dock = DockStyle.Fill;
pictureBoxAntiAircraftGun.Location = new Point(0, 0);
pictureBoxAntiAircraftGun.Name = "pictureBoxAntiAircraftGun";
pictureBoxAntiAircraftGun.Size = new Size(939, 393);
pictureBoxAntiAircraftGun.TabIndex = 8;
pictureBoxAntiAircraftGun.TabStop = false;
//
// buttonDown
//
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonDown.BackgroundImage = Properties.Resources.ArrowDown;
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
buttonDown.Location = new Point(838, 339);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(35, 35);
buttonDown.TabIndex = 2;
buttonDown.UseVisualStyleBackColor = true;
buttonDown.Click += ButtonMove_Click;
//
// buttonLeft
//
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonLeft.BackgroundImage = Properties.Resources.ArrowLeft;
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
buttonLeft.Location = new Point(797, 339);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(35, 35);
buttonLeft.TabIndex = 3;
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.Click += ButtonMove_Click;
//
// buttonUp
//
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonUp.BackgroundImage = Properties.Resources.ArrowUp;
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
buttonUp.Location = new Point(838, 298);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(35, 35);
buttonUp.TabIndex = 4;
buttonUp.UseVisualStyleBackColor = true;
buttonUp.Click += ButtonMove_Click;
//
// buttonRight
//
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRight.BackgroundImage = Properties.Resources.ArrowRight;
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
buttonRight.Location = new Point(876, 339);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(35, 35);
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(776, 12);
comboBoxStrategy.Name = "comboBoxStrategy";
comboBoxStrategy.Size = new Size(151, 28);
comboBoxStrategy.TabIndex = 9;
//
// buttonStrategyStep
//
buttonStrategyStep.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonStrategyStep.Location = new Point(797, 65);
buttonStrategyStep.Name = "buttonStrategyStep";
buttonStrategyStep.Size = new Size(130, 29);
buttonStrategyStep.TabIndex = 10;
buttonStrategyStep.Text = "Шаг";
buttonStrategyStep.UseVisualStyleBackColor = true;
buttonStrategyStep.Click += buttonStrategyStep_Click;
//
// FormAntiAircraftGun
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(939, 393);
Controls.Add(buttonStrategyStep);
Controls.Add(comboBoxStrategy);
Controls.Add(buttonRight);
Controls.Add(buttonUp);
Controls.Add(buttonLeft);
Controls.Add(buttonDown);
Controls.Add(pictureBoxAntiAircraftGun);
Name = "FormAntiAircraftGun";
Text = "Зенитная установка";
((System.ComponentModel.ISupportInitialize)pictureBoxAntiAircraftGun).EndInit();
ResumeLayout(false);
}
#endregion
private PictureBox pictureBoxAntiAircraftGun;
private Button buttonDown;
private Button buttonLeft;
private Button buttonUp;
private Button buttonRight;
private ComboBox comboBoxStrategy;
private Button buttonStrategyStep;
}
}

View File

@ -0,0 +1,124 @@
using AntiAircraftGun.Drawnings;
using AntiAircraftGun.MovementStrategy;
namespace AntiAircraftGun
{
public partial class FormAntiAircraftGun : Form
{
/// <summary>
/// Стратегия перемещения
/// </summary>
private AbstractStrategy? _abstractStrategy;
/// <summary>
/// Поле-объект для прорисовки объекта
/// </summary>
private DrawningGun? _drawningGun;
/// <summary>
/// Конуструктор формы
/// </summary>
public FormAntiAircraftGun()
{
InitializeComponent();
_abstractStrategy = null;
}
/// <summary>
/// Получение объекта
/// </summary>
public DrawningGun SetGun
{
set
{
_drawningGun = value;
_drawningGun.SetPictureSize(pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
comboBoxStrategy.Enabled = true;
_abstractStrategy = null;
Draw();
}
}
/// <summary>
/// Метод рисования машины
/// </summary>
private void Draw()
{
if (_drawningGun == null)
{
return;
}
Bitmap bmp = new(pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
Graphics gr = Graphics.FromImage(bmp);
_drawningGun.DrawTransport(gr);
pictureBoxAntiAircraftGun.Image = bmp;
_drawningGun.DrawTransport(gr);
}
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_drawningGun == null)
{
return;
}
string name = ((Button)sender)?.Name ?? string.Empty;
bool result = false;
switch (name)
{
case "buttonUp":
result =
_drawningGun.MoveTransport(DirectionType.Up);
break;
case "buttonDown":
result =
_drawningGun.MoveTransport(DirectionType.Down);
break;
case "buttonLeft":
result =
_drawningGun.MoveTransport(DirectionType.Left);
break;
case "buttonRight":
result =
_drawningGun.MoveTransport(DirectionType.Right);
break;
}
if (result)
{
Draw();
}
}
private void buttonStrategyStep_Click(object sender, EventArgs e)
{
if (_drawningGun == null)
{
return;
}
if (comboBoxStrategy.Enabled)
{
_abstractStrategy = comboBoxStrategy.SelectedIndex switch
{
0 => new MoveToCenter(),
1 => new MoveToBorder(),
_ => null,
};
if (_abstractStrategy == null)
{
return;
}
_abstractStrategy.SetData(new MoveableGun(_drawningGun),
pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
}
if (_abstractStrategy == null)
{
return;
}
comboBoxStrategy.Enabled = false;
_abstractStrategy.MakeStep();
Draw();
if (_abstractStrategy.GetStatus() == StrategyStatus.Finish)
{
comboBoxStrategy.Enabled = true;
_abstractStrategy = null;
}
}
}
}

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->

View File

@ -0,0 +1,301 @@
namespace AntiAircraftGun
{
partial class FormGunCollections
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
groupBox1 = new GroupBox();
panelCompanyTools = new Panel();
buttonCreateCompany = new Button();
comboBoxSelectorCompany = new ComboBox();
buttonAddGun = new Button();
buttonRefresh = new Button();
buttonAddAntiAircraftGun = new Button();
buttonGoToCheck = new Button();
maskedTextBox = new MaskedTextBox();
buttonRemoveGun = new Button();
panelStorage = new Panel();
buttonCollectionDel = new Button();
listBoxCollection = new ListBox();
buttonCollectionAdd = new Button();
textBoxCollectionName = new TextBox();
radioButtonList = new RadioButton();
radioButtonMassive = new RadioButton();
labelNameCollection = new Label();
pictureBox = new PictureBox();
groupBox1.SuspendLayout();
panelCompanyTools.SuspendLayout();
panelStorage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// groupBox1
//
groupBox1.Controls.Add(panelCompanyTools);
groupBox1.Controls.Add(panelStorage);
groupBox1.Dock = DockStyle.Right;
groupBox1.Location = new Point(981, 0);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(235, 772);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "Инструменты";
//
// panelCompanyTools
//
panelCompanyTools.Controls.Add(buttonCreateCompany);
panelCompanyTools.Controls.Add(comboBoxSelectorCompany);
panelCompanyTools.Controls.Add(buttonAddGun);
panelCompanyTools.Controls.Add(buttonRefresh);
panelCompanyTools.Controls.Add(buttonAddAntiAircraftGun);
panelCompanyTools.Controls.Add(buttonGoToCheck);
panelCompanyTools.Controls.Add(maskedTextBox);
panelCompanyTools.Controls.Add(buttonRemoveGun);
panelCompanyTools.Dock = DockStyle.Bottom;
panelCompanyTools.Location = new Point(3, 395);
panelCompanyTools.Name = "panelCompanyTools";
panelCompanyTools.Size = new Size(229, 374);
panelCompanyTools.TabIndex = 9;
//
// buttonCreateCompany
//
buttonCreateCompany.Location = new Point(9, 40);
buttonCreateCompany.Name = "buttonCreateCompany";
buttonCreateCompany.Size = new Size(217, 29);
buttonCreateCompany.TabIndex = 8;
buttonCreateCompany.Text = "Создать компанию";
buttonCreateCompany.UseVisualStyleBackColor = true;
buttonCreateCompany.Click += ButtonCreateCompany_Click;
//
// 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(9, 6);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(214, 28);
comboBoxSelectorCompany.TabIndex = 0;
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
//
// buttonAddGun
//
buttonAddGun.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddGun.Location = new Point(9, 87);
buttonAddGun.Name = "buttonAddGun";
buttonAddGun.Size = new Size(214, 52);
buttonAddGun.TabIndex = 1;
buttonAddGun.Text = "Добавление установки";
buttonAddGun.UseVisualStyleBackColor = true;
buttonAddGun.Click += ButtonAddGun_Click;
//
// buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRefresh.Location = new Point(9, 313);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(214, 39);
buttonRefresh.TabIndex = 6;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// buttonAddAntiAircraftGun
//
buttonAddAntiAircraftGun.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddAntiAircraftGun.Location = new Point(9, 145);
buttonAddAntiAircraftGun.Name = "buttonAddAntiAircraftGun";
buttonAddAntiAircraftGun.Size = new Size(214, 52);
buttonAddAntiAircraftGun.TabIndex = 2;
buttonAddAntiAircraftGun.Text = "Добавление зенитной установки";
buttonAddAntiAircraftGun.UseVisualStyleBackColor = true;
buttonAddAntiAircraftGun.Click += ButtonAddAntiAircraftGun_Click;
//
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonGoToCheck.Location = new Point(9, 274);
buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(214, 33);
buttonGoToCheck.TabIndex = 5;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
buttonGoToCheck.Click += ButtonGoToCheck_Click;
//
// maskedTextBox
//
maskedTextBox.Location = new Point(9, 203);
maskedTextBox.Mask = "00";
maskedTextBox.Name = "maskedTextBox";
maskedTextBox.Size = new Size(217, 27);
maskedTextBox.TabIndex = 3;
maskedTextBox.ValidatingType = typeof(int);
//
// buttonRemoveGun
//
buttonRemoveGun.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRemoveGun.Location = new Point(9, 236);
buttonRemoveGun.Name = "buttonRemoveGun";
buttonRemoveGun.Size = new Size(214, 32);
buttonRemoveGun.TabIndex = 4;
buttonRemoveGun.Text = "Удалить установку";
buttonRemoveGun.UseVisualStyleBackColor = true;
buttonRemoveGun.Click += ButtonRemoveGun_Click;
//
// panelStorage
//
panelStorage.Controls.Add(buttonCollectionDel);
panelStorage.Controls.Add(listBoxCollection);
panelStorage.Controls.Add(buttonCollectionAdd);
panelStorage.Controls.Add(textBoxCollectionName);
panelStorage.Controls.Add(radioButtonList);
panelStorage.Controls.Add(radioButtonMassive);
panelStorage.Controls.Add(labelNameCollection);
panelStorage.Dock = DockStyle.Top;
panelStorage.Location = new Point(3, 23);
panelStorage.Name = "panelStorage";
panelStorage.Size = new Size(229, 366);
panelStorage.TabIndex = 7;
//
// buttonCollectionDel
//
buttonCollectionDel.Location = new Point(9, 326);
buttonCollectionDel.Name = "buttonCollectionDel";
buttonCollectionDel.Size = new Size(217, 29);
buttonCollectionDel.TabIndex = 6;
buttonCollectionDel.Text = "Удалить коллекцию";
buttonCollectionDel.UseVisualStyleBackColor = true;
buttonCollectionDel.Click += ButtonCollectionDel_Click;
//
// listBoxCollection
//
listBoxCollection.FormattingEnabled = true;
listBoxCollection.ItemHeight = 20;
listBoxCollection.Location = new Point(9, 164);
listBoxCollection.Name = "listBoxCollection";
listBoxCollection.Size = new Size(217, 144);
listBoxCollection.TabIndex = 5;
//
// buttonCollectionAdd
//
buttonCollectionAdd.Location = new Point(9, 120);
buttonCollectionAdd.Name = "buttonCollectionAdd";
buttonCollectionAdd.Size = new Size(217, 29);
buttonCollectionAdd.TabIndex = 4;
buttonCollectionAdd.Text = "Добаваить коллекцию";
buttonCollectionAdd.UseVisualStyleBackColor = true;
buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
//
// textBoxCollectionName
//
textBoxCollectionName.Location = new Point(9, 41);
textBoxCollectionName.Name = "textBoxCollectionName";
textBoxCollectionName.Size = new Size(217, 27);
textBoxCollectionName.TabIndex = 3;
//
// radioButtonList
//
radioButtonList.AutoSize = true;
radioButtonList.Location = new Point(146, 74);
radioButtonList.Name = "radioButtonList";
radioButtonList.Size = new Size(80, 24);
radioButtonList.TabIndex = 2;
radioButtonList.TabStop = true;
radioButtonList.Text = "Список";
radioButtonList.UseVisualStyleBackColor = true;
//
// radioButtonMassive
//
radioButtonMassive.AutoSize = true;
radioButtonMassive.Location = new Point(9, 74);
radioButtonMassive.Name = "radioButtonMassive";
radioButtonMassive.Size = new Size(82, 24);
radioButtonMassive.TabIndex = 1;
radioButtonMassive.TabStop = true;
radioButtonMassive.Text = "Массив";
radioButtonMassive.UseVisualStyleBackColor = true;
//
// labelNameCollection
//
labelNameCollection.AutoSize = true;
labelNameCollection.Location = new Point(41, 11);
labelNameCollection.Name = "labelNameCollection";
labelNameCollection.Size = new Size(155, 20);
labelNameCollection.TabIndex = 0;
labelNameCollection.Text = "Название коллекции";
//
// pictureBox
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(981, 772);
pictureBox.TabIndex = 1;
pictureBox.TabStop = false;
//
// FormGunCollections
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1216, 772);
Controls.Add(pictureBox);
Controls.Add(groupBox1);
Name = "FormGunCollections";
Text = "Коллекция установок";
groupBox1.ResumeLayout(false);
panelCompanyTools.ResumeLayout(false);
panelCompanyTools.PerformLayout();
panelStorage.ResumeLayout(false);
panelStorage.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox groupBox1;
private Button buttonAddGun;
private ComboBox comboBoxSelectorCompany;
private MaskedTextBox maskedTextBox;
private Button buttonAddAntiAircraftGun;
private PictureBox pictureBox;
private Button buttonRemoveGun;
private Button buttonRefresh;
private Button buttonGoToCheck;
private Panel panelStorage;
private ListBox listBoxCollection;
private Button buttonCollectionAdd;
private TextBox textBoxCollectionName;
private RadioButton radioButtonList;
private RadioButton radioButtonMassive;
private Label labelNameCollection;
private Button buttonCreateCompany;
private Button buttonCollectionDel;
private Panel panelCompanyTools;
}
}

View File

@ -0,0 +1,264 @@
using AntiAircraftGun.CollectionGenericObjects;
using AntiAircraftGun.Drawnings;
namespace AntiAircraftGun;
public partial class FormGunCollections : Form
{
private readonly StorageCollection<DrawningGun> _storageCollection;
/// <summary>
/// Компания
/// </summary>
private AbstractCompany? _company = null;
/// <summary>
/// Конструктор
/// </summary>
public FormGunCollections()
{
InitializeComponent();
_storageCollection = new();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
{
panelCompanyTools.Enabled = true;
}
/// <summary>
/// Создание объекта класса перемещения
/// </summary>
/// <param name="type">Тип создаваемого объекта</param>
private void CreateObj(string type)
{
if (_company == null)
{
return;
}
DrawningGun _drawningGun;
Random random = new();
switch (type)
{
case nameof(DrawningGun):
_drawningGun = new DrawningGun(random.Next(100, 300),
random.Next(1000, 3000), SetColor(random));
break;
case nameof(DrawningAntiAircraftGun):
_drawningGun = new DrawningAntiAircraftGun(random.Next(100, 300),
random.Next(1000, 3000),
SetColor(random),
SetColor(random),
random.Next(10, 100),
Convert.ToBoolean(random.Next(0, 2)),
Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
if (_company + _drawningGun)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
/// <summary>
/// Получение цвета
/// </summary>
/// <param name="random">Случайные числа</param>
/// <returns></returns>
private static Color SetColor(Random random)
{
Color color = Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK) { color = dialog.Color; }
return color;
}
/// <summary>
/// Добавление установки
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonAddGun_Click(object sender, EventArgs e)
{
CreateObj(nameof(DrawningGun));
}
/// <summary>
/// Добавление зенитной устновки
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonAddAntiAircraftGun_Click(object sender, EventArgs e)
{
CreateObj(nameof(DrawningAntiAircraftGun));
}
/// <summary>
/// Удаление установки
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonRemoveGun_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
if (string.IsNullOrEmpty(maskedTextBox.Text))
{
return;
}
if (MessageBox.Show("Удалить объект", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; }
int pos = Convert.ToInt32(maskedTextBox.Text);
if (_company - pos)
{
MessageBox.Show("Объект удален");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
/// <summary>
/// Передача объекта на тесты
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonGoToCheck_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
DrawningGun? gun = null;
int counter = 100;
while (gun == null)
{
gun = _company.GetRandomObject();
counter--;
if (counter <= 0)
{
break;
}
}
if (gun == null)
{
return;
}
FormAntiAircraftGun form = new()
{
SetGun = gun,
};
form.ShowDialog();
}
/// <summary>
/// Обновление экрана
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonRefresh_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
pictureBox.Image = _company.Show();
}
/// <summary>
/// Добавление колллекции
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Удаление коллекции
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonCollectionDel_Click(object sender, EventArgs e)
{
if (listBoxCollection.SelectedItem == null || listBoxCollection.SelectedIndex < 0 ) {
MessageBox.Show("Коллекция для удаления не выбрана");
return;
}
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
RerfreshListBoxItems();
}
/// <summary>
/// Создание компании
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonCreateCompany_Click(object sender, EventArgs e)
{
if (listBoxCollection.SelectedIndex < 0 ||
listBoxCollection.SelectedItem == null)
{
MessageBox.Show("Коллекция не выбрана");
return;
}
ICollectionGenericObjects<DrawningGun>? collection =
_storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
if (collection == null)
{
MessageBox.Show("Коллекция не проинициализирована");
return;
}
switch (comboBoxSelectorCompany.Text)
{
case "База":
_company = new GunSharingService(pictureBox.Width,
pictureBox.Height, collection);
break;
}
panelCompanyTools.Enabled = true;
RerfreshListBoxItems();
}
/// <summary>
/// Обновление списка в listBoxCollection
/// </summary>
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);
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
public abstract class AbstractStrategy
{
/// <summary>
/// Перемещаемый объект
/// </summary>
private IMoveableObject? _moveableObject;
/// <summary>
/// Статус перемещения
/// </summary>
private StrategyStatus _state = StrategyStatus.NotInit;
/// <summary>
/// Ширина поля
/// </summary>
protected int FieldWidth { get; private set; }
/// <summary>
/// Высота поля
/// </summary>
protected int FieldHeight { get; private set; }
/// <summary>
/// Статус перемещения
/// </summary>
public StrategyStatus GetStatus() { return _state; }
/// <summary>
/// Установка данных
/// </summary>
/// <param name="moveableObject">Перемещаемый объект</param>
/// <param name="width">Ширина поля</param>
/// <param name="height">Высота поля</param>
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;
}
/// <summary>
/// Шаг перемещения
/// </summary>
public void MakeStep()
{
if (_state != StrategyStatus.InProgress)
{
return;
}
if (IsTargetDestinaion())
{
_state = StrategyStatus.Finish;
return;
}
MoveToTarget();
}
/// <summary>
/// Перемещение влево
/// </summary>
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
/// <summary>
/// Перемещение вправо
/// </summary>
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
protected bool MoveRight() => MoveTo(MovementDirection.Right);
/// <summary>
/// Перемещение вверх
/// </summary>
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
protected bool MoveUp() => MoveTo(MovementDirection.Up);
/// <summary>
/// Перемещение вниз
/// </summary>
/// <returns>Результат перемещения (true - удалось переместиться, false -неудача)</returns>
protected bool MoveDown() => MoveTo(MovementDirection.Down);
/// <summary>/// Параметры объекта
/// </summary>
protected ObjectParameters? GetObjectParameters() => _moveableObject?.GetObjectPosition;
/// <summary>
/// Шаг объекта
/// </summary>
/// <returns></returns>
protected int? GetStep()
{
if (_state != StrategyStatus.InProgress)
{
return null;
}
return _moveableObject?.GetStep;
}
/// <summary>
/// Перемещение к цели
/// </summary>
protected abstract void MoveToTarget();
/// <summary>
/// Достигнута ли цель
/// </summary>
/// <returns></returns>
protected abstract bool IsTargetDestinaion();
/// <summary>
/// Попытка перемещения в требуемом направлении
/// </summary>
/// <param name="movementDirection">Направление</param>
/// <returns>Результат попытки (true - удалось переместиться, false -неудача)</returns>
private bool MoveTo(MovementDirection movementDirection)
{
if (_state != StrategyStatus.InProgress)
{
return false;
}
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
/// <summary>
/// Интерфейс для работы с перемещаемым объектом
/// </summary>
public interface IMoveableObject
{
/// <summary>
/// Получение координаты объекта
/// </summary>
ObjectParameters? GetObjectPosition { get; }
/// <summary>
/// Шаг объекта
/// </summary>
int GetStep { get; }
/// <summary>
/// Попытка переместить объект в указанном направлении
/// </summary>
/// <param name="direction">Направление</param>
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
bool TryMoveObject(MovementDirection direction);
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
public class MoveToBorder : AbstractStrategy
{
protected override bool IsTargetDestinaion()
{
ObjectParameters? objectParameters = GetObjectParameters();
if (objectParameters == null)
{
return false;
}
return objectParameters.RightBorder() <= FieldWidth && objectParameters.RightBorder() + GetStep() >= FieldWidth &&
objectParameters.DownBorder() <= FieldHeight && objectParameters.DownBorder() + GetStep() >= FieldHeight;
}
protected override void MoveToTarget()
{
ObjectParameters? objectParameters=GetObjectParameters();
if(objectParameters == null) { return; }
if (objectParameters.RightBorder() < FieldWidth)
{
MoveRight();
}
if (objectParameters.DownBorder() <FieldHeight)
{
MoveDown();
}
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
public class MoveToCenter : AbstractStrategy
{
protected override bool IsTargetDestinaion()
{
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();
}
}
}
}

View File

@ -0,0 +1,71 @@
using AntiAircraftGun.Drawnings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
/// <summary>
/// Класс-реализация IMoveableObject с ипользованием DrawningGun
/// </summary>
public class MoveableGun : IMoveableObject
{
/// <summary>
/// Поле-объект класса DrawningGun или его наследника
/// </summary>
private readonly DrawningGun? _drawningGun = null;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="drawningGun"></param>
public MoveableGun(DrawningGun? drawningGun)
{
_drawningGun = drawningGun;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawningGun == null || _drawningGun.EntityGun == null ||
!_drawningGun.GetPosX().HasValue ||
!_drawningGun.GetPosY().HasValue)
{
return null;
}
return new ObjectParameters(
_drawningGun.GetPosX().Value,
_drawningGun.GetPosY().Value,
_drawningGun.GetWidth(),
_drawningGun.GetHeight());
}
}
public int GetStep => (int)(_drawningGun?.EntityGun?.Step ?? 0);
public bool TryMoveObject(MovementDirection direction)
{
if (_drawningGun == null || _drawningGun.EntityGun == null)
{
return false;
}
return _drawningGun.MoveTransport(GetDirectionType(direction));
}
/// <summary>
/// Конвертация из MovementDirection в DirectionType
/// </summary>
/// <param name="direction">MovementDirection</param>
/// <returns></returns>
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,
};
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
/// <summary>
/// Направление перемещения
/// </summary>
public enum MovementDirection
{
/// <summary>
/// Вврех
/// </summary>
Up = 1,
/// <summary>
/// Вниз
/// </summary>
Down = 2,
/// <summary>
/// Влево
/// </summary>
Left = 3,
/// <summary>
/// Вправо
/// </summary>
Right = 4,
}

View File

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
/// <summary>
/// Параметры координаты объекта
/// </summary>
public class ObjectParameters
{
/// <summary>
/// Координата x
/// </summary>
private readonly int _x;
/// <summary>
/// Координата y
/// </summary>
private readonly int _y;
/// <summary>
/// Ширина объекта
/// </summary>
private readonly int _width;
/// <summary>
/// Высота объекта
/// </summary>
private readonly int _height;
/// <summary>
/// Левая граница
/// </summary>
public int LeftBorder() => _x;
/// <summary>
/// Верхняя граница
/// </summary>
public int TopBorder() => _y;
/// <summary>
/// Правая граница
/// </summary>
public int RightBorder() => _x + _width;
/// <summary>
/// Нижняя граница
/// </summary>
public int DownBorder() => _y + _height;
/// <summary>
/// Середина объекта
/// </summary>
public int ObjectMiddleHorizontal => _x + _width / 2;
/// <summary>
/// Середина объекта
/// </summary>
public int ObjectMiddleVertical => _y + _height / 2;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="width"></param>
/// <param name="height"></param>
public ObjectParameters(int x, int y, int width, int height)
{
_x = x;
_y = y;
_width = width;
_height = height;
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AntiAircraftGun.MovementStrategy;
/// <summary>
/// Статус выполнения операции перемещения
/// </summary>
public enum StrategyStatus
{
/// <summary>
/// Все готово к началу
/// </summary>
NotInit,
/// <summary>
/// Выполянется
/// </summary>
InProgress,
/// <summary>
/// Завершено
/// </summary>
Finish
}

View File

@ -11,7 +11,7 @@ namespace AntiAircraftGun
// 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 FormGunCollections());
}
}
}

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace AntiAircraftGun.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом 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() {
}
/// <summary>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </summary>
[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("AntiAircraftGun.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ArrowDown {
get {
object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ArrowLeft {
get {
object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ArrowRight {
get {
object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ArrowUp {
get {
object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ArrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ArrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ArrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB