Compare commits
No commits in common. "LabWork06" and "main" have entirely different histories.
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.7.34221.43
|
VisualStudioVersion = 17.7.34221.43
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HoistingCrane", "HoistingCrane\HoistingCrane.csproj", "{915BDF62-D64D-4AB9-BA2D-8E228E803B7F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HoistingCrane", "HoistingCrane\HoistingCrane.csproj", "{915BDF62-D64D-4AB9-BA2D-8E228E803B7F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -1,114 +0,0 @@
|
|||||||
using HoistingCrane.CollectionGenericObjects;
|
|
||||||
using HoistingCrane.Drawning;
|
|
||||||
|
|
||||||
public abstract class AbstractCompany
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Размер места (ширина)
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _placeSizeWidth = 180;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Размер места (высота)
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _placeSizeHeight = 100;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _pictureWidth;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
protected readonly int _pictureHeight;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Коллекция военных кораблей
|
|
||||||
/// </summary>
|
|
||||||
protected ICollectionGenericObjects<DrawningTrackedVehicle>? _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<DrawningTrackedVehicle> collection)
|
|
||||||
{
|
|
||||||
_pictureWidth = picWidth;
|
|
||||||
_pictureHeight = picHeight;
|
|
||||||
_collection = collection;
|
|
||||||
_collection.MaxCount = GetMaxCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перегрузка оператора сложения для класса
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="company">Компания</param>
|
|
||||||
/// <param name="warship">Добавляемый объект</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int operator +(AbstractCompany company, DrawningTrackedVehicle crane)
|
|
||||||
{
|
|
||||||
return company._collection.Insert(crane);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перегрузка оператора удаления для класса
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="company">Компания</param>
|
|
||||||
/// <param name="position">Номер удаляемого объекта</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DrawningTrackedVehicle operator -(AbstractCompany company, int position)
|
|
||||||
{
|
|
||||||
return company._collection.Remove(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение случайного объекта из коллекции
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public DrawningTrackedVehicle? GetRandomObject()
|
|
||||||
{
|
|
||||||
Random rnd = new();
|
|
||||||
return arr?.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 < (arr?.Count ?? 0); ++i)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DrawningTrackedVehicle? obj = arr?.Get(i);
|
|
||||||
obj?.DrawTransport(graphics);
|
|
||||||
}
|
|
||||||
catch (Exception) { }
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Вывод заднего фона
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
protected abstract void DrawBackgound(Graphics g);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Расстановка объектов
|
|
||||||
/// </summary>
|
|
||||||
protected abstract void SetObjectsPosition();
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
namespace HoistingCrane.CollectionGenericObjects
|
|
||||||
{
|
|
||||||
public enum CollectionType
|
|
||||||
{
|
|
||||||
None = 0, Massive = 1, List = 2
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
using HoistingCrane.Drawning;
|
|
||||||
namespace HoistingCrane.CollectionGenericObjects
|
|
||||||
{
|
|
||||||
public class Garage : AbstractCompany
|
|
||||||
{
|
|
||||||
public Garage(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTrackedVehicle> array) : base(picWidth, picHeight, array)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
protected override void DrawBackgound(Graphics g)
|
|
||||||
{
|
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
|
||||||
int height = _pictureHeight / _placeSizeHeight;
|
|
||||||
Pen pen = new(Color.Black, 3);
|
|
||||||
for (int i = 0; i < width; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < height + 1; ++j)
|
|
||||||
{
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth + 15, j * _placeSizeHeight, i * _placeSizeWidth + 15 + _placeSizeWidth - 55, j * _placeSizeHeight);
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth + 15, j * _placeSizeHeight, i * _placeSizeWidth + 15, j * _placeSizeHeight - _placeSizeHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
protected override void SetObjectsPosition()
|
|
||||||
{
|
|
||||||
int countWidth = _pictureWidth / _placeSizeWidth;
|
|
||||||
int countHeight = _pictureHeight / _placeSizeHeight;
|
|
||||||
|
|
||||||
int currentPosWidth = countWidth - 1;
|
|
||||||
int currentPosHeight = countHeight - 1;
|
|
||||||
|
|
||||||
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 * currentPosWidth + 25, _placeSizeHeight * currentPosHeight + 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentPosWidth > 0)
|
|
||||||
currentPosWidth--;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentPosWidth = countWidth - 1;
|
|
||||||
currentPosHeight--;
|
|
||||||
}
|
|
||||||
if (currentPosHeight < 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
using HoistingCrane.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public interface ICollectionGenericObjects<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Количество объектов в коллекции
|
|
||||||
/// </summary>
|
|
||||||
int Count { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установка максимального количества элементов
|
|
||||||
/// </summary>
|
|
||||||
int MaxCount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление объекта в коллекцию
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">Добавляемый объект</param>
|
|
||||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
|
||||||
int Insert(T obj);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление объекта в коллекцию на конкретную позицию
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">Добавляемый объект</param>
|
|
||||||
/// <param name="position">Позиция</param>
|
|
||||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
|
||||||
int Insert(T obj, int position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление объекта из коллекции с конкретной позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position">Позиция</param>
|
|
||||||
/// <returns>true - удаление прошло удачно, false - удаление не удалось</returns>
|
|
||||||
T? Remove(int position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение объекта по позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position">Позиция</param>
|
|
||||||
/// <returns>Объект</returns>
|
|
||||||
T? Get(int position);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение типа коллекции
|
|
||||||
/// </summary>
|
|
||||||
CollectionType GetCollectionType { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение объектов коллекции по одному
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Поэлементый вывод элементов коллекции</returns>
|
|
||||||
IEnumerable<T?> GetItems();
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
using HoistingCrane.Drawning;
|
|
||||||
using HoistingCrane.Exceptions;
|
|
||||||
namespace HoistingCrane.CollectionGenericObjects;
|
|
||||||
|
|
||||||
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 MaxCount
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value > 0)
|
|
||||||
{
|
|
||||||
_maxCount = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CollectionType GetCollectionType => CollectionType.List;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
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 == _maxCount)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
_collection.Add(obj);
|
|
||||||
return Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Remove(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= list.Count) throw new PositionOutOfCollectionException(position);
|
|
||||||
T? temp = list[position];
|
|
||||||
list.RemoveAt(position);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<T?> GetItems()
|
|
||||||
{
|
|
||||||
for(int i = 0; i < list.Count; i++)
|
|
||||||
{
|
|
||||||
yield return list[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CollectionSort(IComparer<T> comparer)
|
|
||||||
{
|
|
||||||
list.Sort(comparer);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,154 +0,0 @@
|
|||||||
namespace HoistingCrane.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
private T?[] arr;
|
|
||||||
public MassivGenericObjects()
|
|
||||||
{
|
|
||||||
arr = Array.Empty<T?>();
|
|
||||||
}
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return arr.Length; }
|
|
||||||
}
|
|
||||||
public int MaxCount
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _collection.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value > 0)
|
|
||||||
{
|
|
||||||
if (_collection.Length > 0)
|
|
||||||
{
|
|
||||||
Array.Resize(ref _collection, value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_collection = new T?[value];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (arr[i] == null)
|
|
||||||
{
|
|
||||||
arr[i] = obj;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new CollectionOverflowException(Count);
|
|
||||||
}
|
|
||||||
catch (PositionOutOfCollectionException ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
catch (ObjectIsPresentInTheCollectionException ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Remove(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= Count) throw new PositionOutOfCollectionException(position);
|
|
||||||
if (arr[position] == null) throw new ObjectNotFoundException(position);
|
|
||||||
T? temp = arr[position];
|
|
||||||
arr[position] = null;
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<T?> GetItems()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < arr.Length; i++)
|
|
||||||
{
|
|
||||||
yield return arr[i];
|
|
||||||
=========
|
|
||||||
>>>>>>>>> Temporary merge branch 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void CollectionSort(IComparer<T> comparer)
|
|
||||||
{
|
|
||||||
T[] notNullArr = arr.OfType<T>().ToArray();
|
|
||||||
Array.Sort(notNullArr, comparer);
|
|
||||||
Array.Copy(notNullArr, 0, arr, 0, notNullArr.Length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Get(int position)
|
|
||||||
{
|
|
||||||
// Проверка позиции
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _collection[position];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Insert(T obj)
|
|
||||||
{
|
|
||||||
// Вставка в свободное место набора
|
|
||||||
return Insert(obj, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Insert(T obj, int position)
|
|
||||||
{
|
|
||||||
// Проверка позиции
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// Проверка, что элемент массива по этой позиции пустой
|
|
||||||
if (_collection[position] == null)
|
|
||||||
{
|
|
||||||
_collection[position] = obj;
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
//Свободное место после этой позиции
|
|
||||||
for (int i = position + 1; i < Count; i++)
|
|
||||||
{
|
|
||||||
if (_collection[i] == null)
|
|
||||||
{
|
|
||||||
_collection[i] = obj;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Свободное место до этой позиции
|
|
||||||
for (int i = position - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
if (_collection[i] == null)
|
|
||||||
{
|
|
||||||
_collection[i] = obj;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? Remove(int position)
|
|
||||||
{
|
|
||||||
// Проверка позиции и наличия объекта
|
|
||||||
if (position < 0 || position >= Count || _collection[position] == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// Удаление объекта из массива
|
|
||||||
T? obj = _collection[position];
|
|
||||||
_collection[position] = null;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<T?> GetItems()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _collection.Length; ++i)
|
|
||||||
{
|
|
||||||
yield return _collection[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,218 +0,0 @@
|
|||||||
using HoistingCrane.Drawning;
|
|
||||||
namespace HoistingCrane.CollectionGenericObjects;
|
|
||||||
|
|
||||||
public class StorageCollection<T>
|
|
||||||
where T : DrawningTrackedVehicle
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Словарь (хранилище) с коллекциями
|
|
||||||
/// </summary>
|
|
||||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращение списка названий коллекций
|
|
||||||
/// </summary>
|
|
||||||
public List<string> Keys => _storages.Keys.ToList();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ключевое слово, с которого должен начинаться файл
|
|
||||||
/// </summary>
|
|
||||||
private readonly string _collectionKey = "CollectionsStorage";
|
|
||||||
/// <summary>
|
|
||||||
/// Разделитель для записи ключа и значения элемента словаря
|
|
||||||
/// </summary>
|
|
||||||
private readonly string _separatorForKeyValue = "|";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Разделитель для записей коллекции данных в файл
|
|
||||||
/// </summary>
|
|
||||||
private readonly string _separatorItems = ";";
|
|
||||||
|
|
||||||
/// <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)
|
|
||||||
{
|
|
||||||
// Проверка, что name не пустой и нет в словаре записи с таким ключом
|
|
||||||
if (string.IsNullOrEmpty(name) || _storages.ContainsKey(name) || collectionType == CollectionType.None)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (collectionType == CollectionType.Massive)
|
|
||||||
{
|
|
||||||
_storages[name] = new MassiveGenericObjects<T>();
|
|
||||||
}
|
|
||||||
if (collectionType == CollectionType.List)
|
|
||||||
{
|
|
||||||
_storages[name] = new ListGenericObjects<T>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление коллекции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">Название коллекции</param>
|
|
||||||
public void DelCollection(string name)
|
|
||||||
{
|
|
||||||
if (_storages.ContainsKey(name))
|
|
||||||
{
|
|
||||||
_storages.Remove(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Доступ к коллекции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">Название коллекции</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ICollectionGenericObjects<T>? this[string name]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_storages.ContainsKey(name))
|
|
||||||
{
|
|
||||||
return _storages[name];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Сохранение информации по военным кораблям в хранилище в файл
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">Путь и имя файла</param>
|
|
||||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
|
||||||
public bool SaveData(string filename)
|
|
||||||
{
|
|
||||||
if (_storages.Count == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(filename))
|
|
||||||
{
|
|
||||||
File.Delete(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamWriter writer = new StreamWriter(filename))
|
|
||||||
{
|
|
||||||
writer.Write(_collectionKey);
|
|
||||||
foreach (KeyValuePair<string, ICollectionGenericObjects<T>> value in _storages)
|
|
||||||
{
|
|
||||||
writer.Write(Environment.NewLine);
|
|
||||||
// не сохраняем пустые коллекции
|
|
||||||
if (value.Value.Count == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
writer.Write(value.Key);
|
|
||||||
writer.Write(_separatorForKeyValue);
|
|
||||||
writer.Write(value.Value.GetCollectionType);
|
|
||||||
writer.Write(_separatorForKeyValue);
|
|
||||||
writer.Write(value.Value.MaxCount);
|
|
||||||
writer.Write(_separatorForKeyValue);
|
|
||||||
foreach (T? item in value.Value.GetItems())
|
|
||||||
{
|
|
||||||
string data = item?.GetDataForSave() ?? string.Empty;
|
|
||||||
if (string.IsNullOrEmpty(data))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
writer.Write(data);
|
|
||||||
writer.Write(_separatorItems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Загрузка информации по военным кораблям в хранилище из файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">Путь и имя файла</param>
|
|
||||||
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
|
||||||
public bool LoadData(string filename)
|
|
||||||
{
|
|
||||||
if (!File.Exists(filename))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamReader read = File.OpenText(filename))
|
|
||||||
{
|
|
||||||
string str = read.ReadLine();
|
|
||||||
if (str == null || str.Length == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!str.StartsWith(_collectionKey))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_storages.Clear();
|
|
||||||
string strs = "";
|
|
||||||
while ((strs = read.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
string[] record = strs.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
if (record.Length != 4)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]);
|
|
||||||
ICollectionGenericObjects<T>? collection = StorageCollection<T>.CreateCollection(collectionType);
|
|
||||||
if (collection == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
collection.MaxCount = Convert.ToInt32(record[2]);
|
|
||||||
|
|
||||||
string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
foreach (string elem in set)
|
|
||||||
{
|
|
||||||
if (elem?.CreateDrawningTrackedVehicle() is T warship)
|
|
||||||
{
|
|
||||||
if (collection.Insert(warship) == -1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_storages.Add(record[0], collection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Создание коллекции по типу
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="collectionType"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static ICollectionGenericObjects<T>? CreateCollection(CollectionType collectionType)
|
|
||||||
{
|
|
||||||
return collectionType switch
|
|
||||||
{
|
|
||||||
CollectionType.Massive => new MassiveGenericObjects<T>(),
|
|
||||||
CollectionType.List => new ListGenericObjects<T>(),
|
|
||||||
_ => null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
namespace HoistingCrane.Drawning;
|
|
||||||
|
|
||||||
public enum DirectionType //Создали не класс(class), а перечисление (enum)
|
|
||||||
{
|
|
||||||
//Перечислим основные траектории движния нашего автомобиля. Сразу же зададим значения.
|
|
||||||
/// <summary>
|
|
||||||
/// Неизвестное направление
|
|
||||||
/// </summary>
|
|
||||||
Unknow = -1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right
|
|
||||||
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
using HoistingCrane.Entities;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Reflection.PortableExecutable;
|
|
||||||
|
|
||||||
namespace HoistingCrane.Drawning;
|
|
||||||
|
|
||||||
//В данном классе мы будем думать над полем игры, размерами персонажа, размерами объектов и т.д.
|
|
||||||
public class DrawningHoistingCrane : DrawningTrackedVehicle
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
private int? _pictureWidth;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
private int? _pictureHeight;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина прорисовки автомобиля
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawingCarWidth = 115;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки автомобиля
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawingCarHeight = 63;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// конструктор класса отрисовки крана
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="AdditionalColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="Counterweight">Противовес</param>
|
|
||||||
/// <param name="Platform">Платформа</param>
|
|
||||||
public DrawningHoistingCrane(int speed, int weight, Color bodyColor, Color additionalColor, bool counterweight, bool platform) : base(115, 63)
|
|
||||||
{
|
|
||||||
EntityTrackedVehicle = new EntityHoistingCrane(speed, weight, bodyColor, additionalColor, counterweight, platform);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор для Extention
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="entityHoistingCrane"></param>
|
|
||||||
public DrawningHoistingCrane(EntityHoistingCrane entityHoistingCrane) : base(115, 63)
|
|
||||||
{
|
|
||||||
EntityTrackedVehicle = new EntityHoistingCrane(entityHoistingCrane.Speed, entityHoistingCrane.Weight, entityHoistingCrane.BodyColor, entityHoistingCrane.AdditionalColor, entityHoistingCrane.Counterweight, entityHoistingCrane.Platform);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Метод отрисовки объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gr"></param>
|
|
||||||
public override void DrawTransport(Graphics gr)
|
|
||||||
{
|
|
||||||
if (EntityTrackedVehicle == null || EntityTrackedVehicle is not EntityHoistingCrane EntityHoistingCrane || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
base.DrawTransport(gr);
|
|
||||||
Brush b = new SolidBrush(EntityHoistingCrane.AdditionalColor);
|
|
||||||
Pen pen = new Pen(EntityHoistingCrane.AdditionalColor);
|
|
||||||
Pen penBase = new Pen(EntityHoistingCrane.BodyColor);
|
|
||||||
if (EntityHoistingCrane.Counterweight)
|
|
||||||
{
|
|
||||||
//противовес
|
|
||||||
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value + 69, _startPosY.Value + 3, 10, 10);
|
|
||||||
gr.DrawLine(pen, _startPosX.Value + 68, _startPosY.Value + 3, _startPosX.Value + 78, _startPosY.Value + 12);
|
|
||||||
gr.DrawLine(pen, _startPosX.Value + 68, _startPosY.Value + 7, _startPosX.Value + 78, _startPosY.Value + 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EntityHoistingCrane.Platform) {
|
|
||||||
//Наличие спусковой платформы
|
|
||||||
|
|
||||||
gr.FillRectangle(b, _startPosX.Value + 101, _startPosY.Value + 40, 15, 5);
|
|
||||||
gr.FillRectangle(b, _startPosX.Value + 116, _startPosY.Value + 35, 4, 5);
|
|
||||||
gr.FillRectangle(b, _startPosX.Value + 97, _startPosY.Value + 35, 4, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Отрисовка крана, на котором держится платформа и противовес
|
|
||||||
gr.FillRectangle(b, _startPosX.Value + 65, _startPosY.Value, 5, 26);
|
|
||||||
gr.FillRectangle(b, _startPosX.Value + 65, _startPosY.Value, 50, 4);
|
|
||||||
gr.DrawLine(penBase, _startPosX.Value + 115, _startPosY.Value + 4, _startPosX.Value + 108, _startPosY.Value + 40);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,273 +0,0 @@
|
|||||||
using HoistingCrane.Entities;
|
|
||||||
using System.Reflection.PortableExecutable;
|
|
||||||
|
|
||||||
namespace HoistingCrane.Drawning
|
|
||||||
{
|
|
||||||
//В данном классе мы будем думать над полем игры, размерами персонажа, размерами объектов и т.д.
|
|
||||||
public class DrawningTrackedVehicle
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс - сущность
|
|
||||||
/// </summary>
|
|
||||||
public EntityTrackedVehicle? EntityTrackedVehicle { get; protected set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
private int? _pictureWidth;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
private int? _pictureHeight;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Стартовая позиция по х
|
|
||||||
/// </summary>
|
|
||||||
protected int? _startPosX;
|
|
||||||
/// <summary>
|
|
||||||
/// Стартовая позиция по у
|
|
||||||
/// </summary>
|
|
||||||
protected int? _startPosY;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина прорисовки автомобиля
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawingCarWidth = 83;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки автомобиля
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _drawingCarHeight = 63;
|
|
||||||
|
|
||||||
public int? GetPosX => _startPosX;
|
|
||||||
public int? GetPosY => _startPosY;
|
|
||||||
public int GetWidth => _drawingCarWidth;
|
|
||||||
public int GetHeight => _drawingCarHeight;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор класса, который принимает параметры автомобиля(скорость, вес и цвет) и создает объект класса с данными параметрами
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес</param>
|
|
||||||
/// <param name="bodyColor">Цвет</param>
|
|
||||||
public DrawningTrackedVehicle(int speed, double weight, Color bodyColor) : this()
|
|
||||||
{
|
|
||||||
EntityTrackedVehicle = new EntityTrackedVehicle(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор, при вызове которого можем менять границы транспорта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="_drawingCarWidth">Ширина прорисовки автомобиля</param>
|
|
||||||
/// <param name="_drawingCarHeight">Высота прорисовки автомобиля</param>
|
|
||||||
protected DrawningTrackedVehicle(int _drawingCarWidth, int _drawingCarHeight) : this()
|
|
||||||
{
|
|
||||||
this._drawingCarWidth = _drawingCarWidth;
|
|
||||||
this._drawingCarHeight = _drawingCarHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Приватный конструктор, который делает значения границ окна = null и стартовую позицию = null
|
|
||||||
/// </summary>
|
|
||||||
private DrawningTrackedVehicle()
|
|
||||||
{
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
_startPosX = null;
|
|
||||||
_startPosY = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор для Extention
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="drawningTrackedVehicle"></param>
|
|
||||||
public DrawningTrackedVehicle(EntityTrackedVehicle entityTrackedVehicle) : this()
|
|
||||||
{
|
|
||||||
EntityTrackedVehicle = new EntityTrackedVehicle(entityTrackedVehicle.Speed, entityTrackedVehicle.Weight, entityTrackedVehicle.BodyColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Метод отрисовки игрового поля
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="width">Ширина поля</param>
|
|
||||||
/// <param name="height">Высота поля</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
|
|
||||||
public bool SetPictureSize(int width, int height)
|
|
||||||
{
|
|
||||||
// TODO проверка, что объект "влезает" в размеры поля
|
|
||||||
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена ✔
|
|
||||||
|
|
||||||
if (_drawingCarHeight > height || _drawingCarWidth > width)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_pictureHeight = height;
|
|
||||||
_pictureWidth = width;
|
|
||||||
|
|
||||||
if (_startPosX.HasValue && _startPosX.Value + _drawingCarWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth - _drawingCarWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_startPosY.HasValue && _startPosY.Value + _drawingCarHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight - _drawingCarHeight;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установим позицию игрока
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата по Х</param>
|
|
||||||
/// <param name="y">Координата по У</param>
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
//Если размеры были заданы, то присваиваем х и у, иначе выходим из метода
|
|
||||||
|
|
||||||
if (x < 0)
|
|
||||||
x = -x;
|
|
||||||
if (y < 0)
|
|
||||||
y = -y;
|
|
||||||
if (x + _drawingCarWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth - _drawingCarWidth;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_startPosX = x;
|
|
||||||
}
|
|
||||||
if (y + _drawingCarHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight - _drawingCarHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение машины
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
|
|
||||||
public bool MoveTransport(DirectionType direction) //Подключили модив\фикатор virtual для переопределения в дочернем классе
|
|
||||||
{
|
|
||||||
if (EntityTrackedVehicle == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
case DirectionType.Left:
|
|
||||||
if (_startPosX.Value - EntityTrackedVehicle.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityTrackedVehicle.Step;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
//вверх
|
|
||||||
case DirectionType.Up:
|
|
||||||
if (_startPosY.Value - EntityTrackedVehicle.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityTrackedVehicle.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
//вправо
|
|
||||||
case DirectionType.Right:
|
|
||||||
if (_startPosX.Value + EntityTrackedVehicle.Step + _drawingCarWidth < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityTrackedVehicle.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
//вниз
|
|
||||||
case DirectionType.Down:
|
|
||||||
if (_startPosY.Value + EntityTrackedVehicle.Step + _drawingCarHeight < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityTrackedVehicle.Step;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default: return false;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Метод отрисовки объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="gr"></param>
|
|
||||||
public virtual void DrawTransport(Graphics gr)
|
|
||||||
{
|
|
||||||
if (EntityTrackedVehicle == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new Pen(Color.Black);
|
|
||||||
|
|
||||||
|
|
||||||
//границы
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 25, 75, 20);
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 25, 25);
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value + 4, _startPosY.Value + 4, 17, 17);
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value + 52, _startPosY.Value + 7, 6, 18);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 45, 20, 20);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value + 63, _startPosY.Value + 45, 20, 20);
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 45, 68, 20);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 46, 18, 18);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value + 62, _startPosY.Value + 46, 18, 18);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 53, 10, 10);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value + 35, _startPosY.Value + 53, 10, 10);
|
|
||||||
gr.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 53, 10, 10);
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value + 30, _startPosY.Value + 45, 4, 6);
|
|
||||||
gr.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 45, 4, 6);
|
|
||||||
|
|
||||||
//корпус
|
|
||||||
Brush br = new SolidBrush(EntityTrackedVehicle.BodyColor);
|
|
||||||
gr.FillRectangle(br, _startPosX.Value, _startPosY.Value + 25, 75, 25);
|
|
||||||
gr.FillRectangle(br, _startPosX.Value, _startPosY.Value, 25, 25);
|
|
||||||
|
|
||||||
|
|
||||||
//окно
|
|
||||||
Brush brq = new SolidBrush(Color.AliceBlue);
|
|
||||||
gr.FillRectangle(brq, _startPosX.Value + 4, _startPosY.Value + 4, 17, 17);
|
|
||||||
|
|
||||||
|
|
||||||
//выхлопная труба
|
|
||||||
Brush brBlack = new SolidBrush(Color.Black);
|
|
||||||
gr.FillRectangle(brBlack, _startPosX.Value + 52, _startPosY.Value + 7, 6, 18);
|
|
||||||
|
|
||||||
|
|
||||||
//гусеница
|
|
||||||
Brush brDarkGray = new SolidBrush(Color.DarkGray);
|
|
||||||
gr.FillEllipse(brDarkGray, _startPosX.Value - 5, _startPosY.Value + 45, 20, 20);
|
|
||||||
gr.FillEllipse(brDarkGray, _startPosX.Value + 63, _startPosY.Value + 45, 20, 20);
|
|
||||||
gr.FillRectangle(brDarkGray, _startPosX.Value + 5, _startPosY.Value + 45, 68, 20);
|
|
||||||
|
|
||||||
gr.FillEllipse(brq, _startPosX.Value - 1, _startPosY.Value + 46, 18, 18);
|
|
||||||
gr.FillEllipse(brq, _startPosX.Value + 62, _startPosY.Value + 46, 18, 18);
|
|
||||||
gr.FillEllipse(brq, _startPosX.Value + 20, _startPosY.Value + 53, 10, 10);
|
|
||||||
gr.FillEllipse(brq, _startPosX.Value + 35, _startPosY.Value + 53, 10, 10);
|
|
||||||
gr.FillEllipse(brq, _startPosX.Value + 50, _startPosY.Value + 53, 10, 10);
|
|
||||||
gr.FillRectangle(brq, _startPosX.Value + 30, _startPosY.Value + 45, 4, 6);
|
|
||||||
gr.FillRectangle(brq, _startPosX.Value + 45, _startPosY.Value + 45, 4, 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
using HoistingCrane.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace HoistingCrane.Drawning
|
|
||||||
{
|
|
||||||
public static class ExtentionDrawningCrane
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Разделитель для записи информации по объекту в файл
|
|
||||||
/// </summary>
|
|
||||||
private static readonly string _separatorForObject = ":";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Создание объекта из строки
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info">Строка с данными для создания объекта</param>
|
|
||||||
/// <returns>Объект</returns>
|
|
||||||
public static DrawningTrackedVehicle? CreateDrawningTrackedVehicle(this string info)
|
|
||||||
{
|
|
||||||
string[] strs = info.Split(_separatorForObject);
|
|
||||||
EntityTrackedVehicle? trackedVehicle = EntityHoistingCrane.CreateEntityHoistingCrane(strs);
|
|
||||||
if (trackedVehicle != null)
|
|
||||||
{
|
|
||||||
return new DrawningHoistingCrane((EntityHoistingCrane)trackedVehicle);
|
|
||||||
}
|
|
||||||
trackedVehicle = EntityTrackedVehicle.CreateEntityTrackedVehicle(strs);
|
|
||||||
if (trackedVehicle != null)
|
|
||||||
{
|
|
||||||
return new DrawningTrackedVehicle(trackedVehicle);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение данных для сохранения в файл
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="drawningTrackedMachine">Сохраняемый объект</param>
|
|
||||||
/// <returns>Строка с данными по объекту</returns>
|
|
||||||
public static string GetDataForSave(this DrawningTrackedVehicle drawningTrackedVehicle)
|
|
||||||
{
|
|
||||||
string[]? array = drawningTrackedVehicle?.EntityTrackedVehicle?.GetStringRepresentation();
|
|
||||||
|
|
||||||
if (array == null)
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
|
|
||||||
}
|
|
||||||
return string.Join(_separatorForObject, array);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
namespace HoistingCrane.Entities;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Êëàññ-ñóùíîñòü (Ïîäúåìíûé êðàí) Êëàññ íàñëåäíèê
|
|
||||||
/// </summary>
|
|
||||||
public class EntityHoistingCrane : EntityTrackedVehicle
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Äîïîëíèòåëüíûé öâåò îáúåêòà
|
|
||||||
/// </summary>
|
|
||||||
public Color AdditionalColor { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Íàëè÷èå ïðîòèâîâåñà
|
|
||||||
/// </summary>
|
|
||||||
public bool Counterweight { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Íàëè÷èå ïëàòôîðìû
|
|
||||||
/// </summary>
|
|
||||||
public bool Platform { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ìåòîä çàäà÷è ïàðàìåòðîâ
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="AdditionalColor">Äîï. öâåò</param>
|
|
||||||
/// <param name="Counterweight">Ãðóç äëÿ ðàâíîâåñèÿ</param>
|
|
||||||
/// <param name="Platform">Ïëàòôîðìà íà âåðåâêå</param>
|
|
||||||
|
|
||||||
|
|
||||||
// Äîïîëíÿåò íåäîñòîþùèå ýëåìåíòû èç ðîä. êëàññà
|
|
||||||
public EntityHoistingCrane(int Speed, double Weight, Color BodyColor, Color AdditionalColor, bool Counterweight, bool Platform) : base(Speed, Weight, BodyColor)
|
|
||||||
{
|
|
||||||
this.AdditionalColor = AdditionalColor;
|
|
||||||
this.Counterweight = Counterweight;
|
|
||||||
this.Platform = Platform;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetAdditionalColor(Color newColor)
|
|
||||||
{
|
|
||||||
AdditionalColor = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ïîëó÷óåèí ñòðîê ñî çíà÷åíèÿìè ñâîéñòâ îáúåêòà êëàññà-ñóùíîñòè
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override string[] GetStringRepresentation()
|
|
||||||
{
|
|
||||||
return new[] { nameof(EntityHoistingCrane), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name, Counterweight.ToString(), Platform.ToString()};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ñîçäàíèå îáúåêòà èç ìàññèâà ñòðîê
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="strs"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static EntityHoistingCrane? CreateEntityHoistingCrane(string[] strs)
|
|
||||||
{
|
|
||||||
if (strs.Length != 7 || strs[0] != nameof(EntityHoistingCrane))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new EntityHoistingCrane(Convert.ToInt32(strs[1]), Convert.ToInt32(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
namespace HoistingCrane.Entities
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-сущность (Гусеничная машина) Родительский класс
|
|
||||||
/// </summary>
|
|
||||||
public class EntityTrackedVehicle
|
|
||||||
{
|
|
||||||
/// <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 => Speed * 100 / Weight;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор сущности
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Speed">Скорость</param>
|
|
||||||
/// <param name="Weight">Вес</param>
|
|
||||||
/// <param name="BodyColor">Основной цвет</param>
|
|
||||||
|
|
||||||
public EntityTrackedVehicle(int Speed, double Weight, Color BodyColor)
|
|
||||||
{
|
|
||||||
this.Speed = Speed;
|
|
||||||
this.Weight = Weight;
|
|
||||||
this.BodyColor = BodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetBodyColor(Color newBodyColor)
|
|
||||||
{
|
|
||||||
BodyColor = newBodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получуеин строк со значениями свойств объекта класса-сущности
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public virtual string[] GetStringRepresentation()
|
|
||||||
{
|
|
||||||
return new[] { nameof(EntityTrackedVehicle), Speed.ToString(), Weight.ToString(), BodyColor.Name };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Создание объекта из массива строк
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="strs"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static EntityTrackedVehicle? CreateEntityTrackedVehicle(string[] strs)
|
|
||||||
{
|
|
||||||
if(strs.Length != 4 || strs[0] != nameof(EntityTrackedVehicle))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new EntityTrackedVehicle(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
39
HoistingCrane/HoistingCrane/Form1.Designer.cs
generated
Normal file
39
HoistingCrane/HoistingCrane/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace HoistingCrane
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
HoistingCrane/HoistingCrane/Form1.cs
Normal file
10
HoistingCrane/HoistingCrane/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace HoistingCrane
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,351 +0,0 @@
|
|||||||
namespace HoistingCrane
|
|
||||||
{
|
|
||||||
partial class FormCarCollection
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
groupBoxTools = new GroupBox();
|
|
||||||
panelCompanyTool = new Panel();
|
|
||||||
buttonCreateHoistingCrane = new Button();
|
|
||||||
maskedTextBox = new MaskedTextBox();
|
|
||||||
buttonRefresh = new Button();
|
|
||||||
buttonGoToChek = new Button();
|
|
||||||
buttonDeleteCar = new Button();
|
|
||||||
buttonCreateCompany = new Button();
|
|
||||||
panelStorage = new Panel();
|
|
||||||
buttonDeleteCollection = 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();
|
|
||||||
menuStrip = new MenuStrip();
|
|
||||||
файлToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
saveToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
loadToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
saveFileDialog = new SaveFileDialog();
|
|
||||||
openFileDialog = new OpenFileDialog();
|
|
||||||
buttonSortByType = new Button();
|
|
||||||
buttonSortByColor = new Button();
|
|
||||||
groupBoxTools.SuspendLayout();
|
|
||||||
panelCompanyTool.SuspendLayout();
|
|
||||||
panelStorage.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
|
||||||
menuStrip.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBoxTools
|
|
||||||
//
|
|
||||||
groupBoxTools.Controls.Add(panelCompanyTool);
|
|
||||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
|
||||||
groupBoxTools.Controls.Add(panelStorage);
|
|
||||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
|
||||||
groupBoxTools.Dock = DockStyle.Right;
|
|
||||||
groupBoxTools.Location = new Point(763, 24);
|
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
|
||||||
groupBoxTools.Size = new Size(210, 524);
|
|
||||||
groupBoxTools.TabIndex = 0;
|
|
||||||
groupBoxTools.TabStop = false;
|
|
||||||
groupBoxTools.Text = "Инструменты";
|
|
||||||
//
|
|
||||||
// panelCompanyTool
|
|
||||||
//
|
|
||||||
panelCompanyTool.Anchor = AnchorStyles.None;
|
|
||||||
panelCompanyTool.Controls.Add(buttonSortByColor);
|
|
||||||
panelCompanyTool.Controls.Add(buttonSortByType);
|
|
||||||
panelCompanyTool.Controls.Add(buttonCreateHoistingCrane);
|
|
||||||
panelCompanyTool.Controls.Add(maskedTextBox);
|
|
||||||
panelCompanyTool.Controls.Add(buttonRefresh);
|
|
||||||
panelCompanyTool.Controls.Add(buttonGoToChek);
|
|
||||||
panelCompanyTool.Controls.Add(buttonDeleteCar);
|
|
||||||
panelCompanyTool.Location = new Point(6, 296);
|
|
||||||
panelCompanyTool.Name = "panelCompanyTool";
|
|
||||||
panelCompanyTool.Size = new Size(204, 221);
|
|
||||||
panelCompanyTool.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// buttonCreateHoistingCrane
|
|
||||||
//
|
|
||||||
buttonCreateHoistingCrane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonCreateHoistingCrane.Location = new Point(6, 3);
|
|
||||||
buttonCreateHoistingCrane.Name = "buttonCreateHoistingCrane";
|
|
||||||
buttonCreateHoistingCrane.Size = new Size(192, 22);
|
|
||||||
buttonCreateHoistingCrane.TabIndex = 0;
|
|
||||||
buttonCreateHoistingCrane.Text = "Добавить транспорт";
|
|
||||||
buttonCreateHoistingCrane.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateHoistingCrane.Click += buttonCreateHoistingCrane_Click;
|
|
||||||
//
|
|
||||||
// maskedTextBox
|
|
||||||
//
|
|
||||||
maskedTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
maskedTextBox.Location = new Point(6, 31);
|
|
||||||
maskedTextBox.Mask = "00";
|
|
||||||
maskedTextBox.Name = "maskedTextBox";
|
|
||||||
maskedTextBox.Size = new Size(192, 23);
|
|
||||||
maskedTextBox.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonRefresh.Location = new Point(6, 119);
|
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
|
||||||
buttonRefresh.Size = new Size(192, 27);
|
|
||||||
buttonRefresh.TabIndex = 5;
|
|
||||||
buttonRefresh.Text = "Обновить";
|
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
buttonRefresh.Click += buttonRefresh_Click;
|
|
||||||
//
|
|
||||||
// buttonGoToChek
|
|
||||||
//
|
|
||||||
buttonGoToChek.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonGoToChek.Location = new Point(6, 89);
|
|
||||||
buttonGoToChek.Name = "buttonGoToChek";
|
|
||||||
buttonGoToChek.Size = new Size(192, 24);
|
|
||||||
buttonGoToChek.TabIndex = 6;
|
|
||||||
buttonGoToChek.Text = "Передать на тесты";
|
|
||||||
buttonGoToChek.UseVisualStyleBackColor = true;
|
|
||||||
buttonGoToChek.Click += buttonGoToChek_Click;
|
|
||||||
//
|
|
||||||
// buttonDeleteCar
|
|
||||||
//
|
|
||||||
buttonDeleteCar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
||||||
buttonDeleteCar.Location = new Point(6, 60);
|
|
||||||
buttonDeleteCar.Name = "buttonDeleteCar";
|
|
||||||
buttonDeleteCar.Size = new Size(192, 23);
|
|
||||||
buttonDeleteCar.TabIndex = 4;
|
|
||||||
buttonDeleteCar.Text = "Удалить автомобиль";
|
|
||||||
buttonDeleteCar.UseVisualStyleBackColor = true;
|
|
||||||
buttonDeleteCar.Click += buttonDeleteCar_Click;
|
|
||||||
//
|
|
||||||
// buttonCreateCompany
|
|
||||||
//
|
|
||||||
buttonCreateCompany.Location = new Point(12, 267);
|
|
||||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
|
||||||
buttonCreateCompany.Size = new Size(192, 23);
|
|
||||||
buttonCreateCompany.TabIndex = 7;
|
|
||||||
buttonCreateCompany.Text = "Создать компанию";
|
|
||||||
buttonCreateCompany.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreateCompany.Click += buttonCreateCompany_Click;
|
|
||||||
//
|
|
||||||
// panelStorage
|
|
||||||
//
|
|
||||||
panelStorage.Controls.Add(buttonDeleteCollection);
|
|
||||||
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(3, 19);
|
|
||||||
panelStorage.Name = "panelStorage";
|
|
||||||
panelStorage.Size = new Size(204, 216);
|
|
||||||
panelStorage.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonDeleteCollection
|
|
||||||
//
|
|
||||||
buttonDeleteCollection.Location = new Point(9, 186);
|
|
||||||
buttonDeleteCollection.Name = "buttonDeleteCollection";
|
|
||||||
buttonDeleteCollection.Size = new Size(192, 27);
|
|
||||||
buttonDeleteCollection.TabIndex = 6;
|
|
||||||
buttonDeleteCollection.Text = "Удалить коллекцию";
|
|
||||||
buttonDeleteCollection.UseVisualStyleBackColor = true;
|
|
||||||
buttonDeleteCollection.Click += buttonDeleteCollection_Click;
|
|
||||||
//
|
|
||||||
// listBoxCollection
|
|
||||||
//
|
|
||||||
listBoxCollection.FormattingEnabled = true;
|
|
||||||
listBoxCollection.ItemHeight = 15;
|
|
||||||
listBoxCollection.Location = new Point(9, 101);
|
|
||||||
listBoxCollection.Name = "listBoxCollection";
|
|
||||||
listBoxCollection.Size = new Size(192, 79);
|
|
||||||
listBoxCollection.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// buttonCollectionAdd
|
|
||||||
//
|
|
||||||
buttonCollectionAdd.Location = new Point(9, 72);
|
|
||||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
|
||||||
buttonCollectionAdd.Size = new Size(192, 23);
|
|
||||||
buttonCollectionAdd.TabIndex = 4;
|
|
||||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
|
||||||
buttonCollectionAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonCollectionAdd.Click += buttonCollectionAdd_Click;
|
|
||||||
//
|
|
||||||
// radioButtonList
|
|
||||||
//
|
|
||||||
radioButtonList.AutoSize = true;
|
|
||||||
radioButtonList.Location = new Point(128, 47);
|
|
||||||
radioButtonList.Name = "radioButtonList";
|
|
||||||
radioButtonList.Size = new Size(66, 19);
|
|
||||||
radioButtonList.TabIndex = 3;
|
|
||||||
radioButtonList.TabStop = true;
|
|
||||||
radioButtonList.Text = "Список";
|
|
||||||
radioButtonList.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// radioButtonMassive
|
|
||||||
//
|
|
||||||
radioButtonMassive.AutoSize = true;
|
|
||||||
radioButtonMassive.Location = new Point(12, 47);
|
|
||||||
radioButtonMassive.Name = "radioButtonMassive";
|
|
||||||
radioButtonMassive.Size = new Size(67, 19);
|
|
||||||
radioButtonMassive.TabIndex = 2;
|
|
||||||
radioButtonMassive.TabStop = true;
|
|
||||||
radioButtonMassive.Text = "Массив";
|
|
||||||
radioButtonMassive.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// textBoxCollectionName
|
|
||||||
//
|
|
||||||
textBoxCollectionName.Location = new Point(9, 18);
|
|
||||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
|
||||||
textBoxCollectionName.Size = new Size(192, 23);
|
|
||||||
textBoxCollectionName.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelCollectionName
|
|
||||||
//
|
|
||||||
labelCollectionName.AutoSize = true;
|
|
||||||
labelCollectionName.Location = new Point(35, 0);
|
|
||||||
labelCollectionName.Name = "labelCollectionName";
|
|
||||||
labelCollectionName.Size = new Size(125, 15);
|
|
||||||
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(12, 238);
|
|
||||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
|
||||||
comboBoxSelectorCompany.Size = new Size(192, 23);
|
|
||||||
comboBoxSelectorCompany.TabIndex = 2;
|
|
||||||
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
|
||||||
//
|
|
||||||
// pictureBox
|
|
||||||
//
|
|
||||||
pictureBox.Dock = DockStyle.Fill;
|
|
||||||
pictureBox.Location = new Point(0, 24);
|
|
||||||
pictureBox.Name = "pictureBox";
|
|
||||||
pictureBox.Size = new Size(763, 524);
|
|
||||||
pictureBox.TabIndex = 1;
|
|
||||||
pictureBox.TabStop = false;
|
|
||||||
//
|
|
||||||
// menuStrip
|
|
||||||
//
|
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { файлToolStripMenuItem });
|
|
||||||
menuStrip.Location = new Point(0, 0);
|
|
||||||
menuStrip.Name = "menuStrip";
|
|
||||||
menuStrip.Size = new Size(973, 24);
|
|
||||||
menuStrip.TabIndex = 2;
|
|
||||||
menuStrip.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// файлToolStripMenuItem
|
|
||||||
//
|
|
||||||
файлToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { saveToolStripMenuItem, loadToolStripMenuItem });
|
|
||||||
файлToolStripMenuItem.Name = "файлToolStripMenuItem";
|
|
||||||
файлToolStripMenuItem.Size = new Size(48, 20);
|
|
||||||
файлToolStripMenuItem.Text = "Файл";
|
|
||||||
//
|
|
||||||
// saveToolStripMenuItem
|
|
||||||
//
|
|
||||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
|
||||||
saveToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.S;
|
|
||||||
saveToolStripMenuItem.Size = new Size(181, 22);
|
|
||||||
saveToolStripMenuItem.Text = "Сохранение";
|
|
||||||
saveToolStripMenuItem.Click += saveToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// loadToolStripMenuItem
|
|
||||||
//
|
|
||||||
loadToolStripMenuItem.Name = "loadToolStripMenuItem";
|
|
||||||
loadToolStripMenuItem.ShortcutKeys = Keys.Control | Keys.L;
|
|
||||||
loadToolStripMenuItem.Size = new Size(181, 22);
|
|
||||||
loadToolStripMenuItem.Text = "Загрузка";
|
|
||||||
loadToolStripMenuItem.Click += loadToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// saveFileDialog
|
|
||||||
//
|
|
||||||
saveFileDialog.Filter = "txt file | *.txt";
|
|
||||||
//
|
|
||||||
// openFileDialog
|
|
||||||
//
|
|
||||||
openFileDialog.Filter = "txt file | *.txt";
|
|
||||||
//
|
|
||||||
// FormCarCollection
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(973, 548);
|
|
||||||
Controls.Add(pictureBox);
|
|
||||||
Controls.Add(groupBoxTools);
|
|
||||||
Controls.Add(menuStrip);
|
|
||||||
MainMenuStrip = menuStrip;
|
|
||||||
Name = "FormCarCollection";
|
|
||||||
Text = "FormCarCollections";
|
|
||||||
groupBoxTools.ResumeLayout(false);
|
|
||||||
panelCompanyTool.ResumeLayout(false);
|
|
||||||
panelCompanyTool.PerformLayout();
|
|
||||||
panelStorage.ResumeLayout(false);
|
|
||||||
panelStorage.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
|
||||||
menuStrip.ResumeLayout(false);
|
|
||||||
menuStrip.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBoxTools;
|
|
||||||
private Button buttonCreateHoistingCrane;
|
|
||||||
private ComboBox comboBoxSelectorCompany;
|
|
||||||
private Button buttonRefresh;
|
|
||||||
private Button buttonDeleteCar;
|
|
||||||
private MaskedTextBox maskedTextBox;
|
|
||||||
private PictureBox pictureBox;
|
|
||||||
private Button buttonGoToChek;
|
|
||||||
private Panel panelStorage;
|
|
||||||
private RadioButton radioButtonList;
|
|
||||||
private RadioButton radioButtonMassive;
|
|
||||||
private TextBox textBoxCollectionName;
|
|
||||||
private Label labelCollectionName;
|
|
||||||
private Button buttonCreateCompany;
|
|
||||||
private Button buttonDeleteCollection;
|
|
||||||
private ListBox listBoxCollection;
|
|
||||||
private Button buttonCollectionAdd;
|
|
||||||
private Panel panelCompanyTool;
|
|
||||||
private MenuStrip menuStrip;
|
|
||||||
private ToolStripMenuItem файлToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem saveToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem loadToolStripMenuItem;
|
|
||||||
private SaveFileDialog saveFileDialog;
|
|
||||||
private OpenFileDialog openFileDialog;
|
|
||||||
private Button buttonSortByColor;
|
|
||||||
private Button buttonSortByType;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,207 +0,0 @@
|
|||||||
using HoistingCrane.CollectionGenericObjects;
|
|
||||||
using HoistingCrane.Drawning;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
namespace HoistingCrane
|
|
||||||
{
|
|
||||||
public partial class FormCarCollection : Form
|
|
||||||
{
|
|
||||||
private AbstractCompany? _company;
|
|
||||||
|
|
||||||
private readonly StorageCollection<DrawningTrackedVehicle> _storageCollection;
|
|
||||||
/// <summary>
|
|
||||||
/// Логгер
|
|
||||||
/// </summary>
|
|
||||||
private readonly ILogger logger;
|
|
||||||
public FormCarCollection()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_storageCollection = new();
|
|
||||||
panelCompanyTool.Enabled = false;
|
|
||||||
}
|
|
||||||
private void comboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
panelCompanyTool.Enabled = false;
|
|
||||||
}
|
|
||||||
private void buttonCreateHoistingCrane_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
FormCarConfig form = new();
|
|
||||||
form.Show();
|
|
||||||
form.AddEvent(SetCrane);
|
|
||||||
}
|
|
||||||
private void SetCrane(DrawningTrackedVehicle drawningTrackedVehicle)
|
|
||||||
{
|
|
||||||
if (_company == null || drawningTrackedVehicle == null) return;
|
|
||||||
|
|
||||||
if (_company + drawningTrackedVehicle != -1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonDeleteCar_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(maskedTextBox.Text) || _company == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int pos = Convert.ToInt32(maskedTextBox.Text);
|
|
||||||
if ((_company - pos) != null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект удален!");
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось удалить объект");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
private void buttonRefresh_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_company == null) return;
|
|
||||||
pictureBox.Image = _company.Show();
|
|
||||||
}
|
|
||||||
private void buttonGoToChek_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_company == null) return;
|
|
||||||
DrawningTrackedVehicle? car = null;
|
|
||||||
int count = 100;
|
|
||||||
while (car == null)
|
|
||||||
{
|
|
||||||
car = _company.GetRandomObject();
|
|
||||||
count--;
|
|
||||||
if (count <= 0) break;
|
|
||||||
}
|
|
||||||
if (car == null) return;
|
|
||||||
FormHoistingCrane form = new()
|
|
||||||
{
|
|
||||||
SetCar = car
|
|
||||||
};
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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 buttonDeleteCollection_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();
|
|
||||||
|
|
||||||
}
|
|
||||||
private void buttonCreateCompany_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не выбрана");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ICollectionGenericObjects<DrawningTrackedVehicle>? collection = _storageCollection[listBoxCollection.SelectedItem.ToString() ?? string.Empty];
|
|
||||||
if (collection == null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Коллекция не проинициализирована");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
switch (comboBoxSelectorCompany.Text)
|
|
||||||
{
|
|
||||||
case "Хранилище":
|
|
||||||
_company = new Garage(pictureBox.Width, pictureBox.Height, collection);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
panelCompanyTool.Enabled = true;
|
|
||||||
RerfreshListBoxItems();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Обработка нажатия "Сохранение"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_storageCollection.SaveData(saveFileDialog.FileName);
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Обработка нажатия "Загразка"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void loadToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_storageCollection.LoadData(openFileDialog.FileName);
|
|
||||||
RerfreshListBoxItems();
|
|
||||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,132 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 5</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>130, 5</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>270, 5</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
|
||||||
<value>25</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
358
HoistingCrane/HoistingCrane/FormCarConfig.Designer.cs
generated
358
HoistingCrane/HoistingCrane/FormCarConfig.Designer.cs
generated
@ -1,358 +0,0 @@
|
|||||||
namespace HoistingCrane
|
|
||||||
{
|
|
||||||
partial class FormCarConfig
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
groupBoxConfig = new GroupBox();
|
|
||||||
groupBoxColors = new GroupBox();
|
|
||||||
panelColorPurple = new Panel();
|
|
||||||
panelColorYellow = new Panel();
|
|
||||||
panelColorGray = new Panel();
|
|
||||||
panelColorGreen = new Panel();
|
|
||||||
panelColorWhite = new Panel();
|
|
||||||
panelColorBlue = new Panel();
|
|
||||||
panelColorBlack = new Panel();
|
|
||||||
panelColorRed = new Panel();
|
|
||||||
checkBoxPlatform = new CheckBox();
|
|
||||||
checkBoxCounterweight = new CheckBox();
|
|
||||||
numericUpDownWeight = new NumericUpDown();
|
|
||||||
numericUpDownSpeed = new NumericUpDown();
|
|
||||||
labelWeight = new Label();
|
|
||||||
labelSpeed = new Label();
|
|
||||||
labelModifiedObject = new Label();
|
|
||||||
labelSimpleObject = new Label();
|
|
||||||
panel = new Panel();
|
|
||||||
labelAdditionalColor = new Label();
|
|
||||||
labelBodyColor = new Label();
|
|
||||||
pictureBoxObject = new PictureBox();
|
|
||||||
buttonAdd = new Button();
|
|
||||||
buttonCancel = new Button();
|
|
||||||
groupBoxConfig.SuspendLayout();
|
|
||||||
groupBoxColors.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
|
||||||
panel.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBoxConfig
|
|
||||||
//
|
|
||||||
groupBoxConfig.Controls.Add(groupBoxColors);
|
|
||||||
groupBoxConfig.Controls.Add(checkBoxPlatform);
|
|
||||||
groupBoxConfig.Controls.Add(checkBoxCounterweight);
|
|
||||||
groupBoxConfig.Controls.Add(numericUpDownWeight);
|
|
||||||
groupBoxConfig.Controls.Add(numericUpDownSpeed);
|
|
||||||
groupBoxConfig.Controls.Add(labelWeight);
|
|
||||||
groupBoxConfig.Controls.Add(labelSpeed);
|
|
||||||
groupBoxConfig.Controls.Add(labelModifiedObject);
|
|
||||||
groupBoxConfig.Controls.Add(labelSimpleObject);
|
|
||||||
groupBoxConfig.Dock = DockStyle.Left;
|
|
||||||
groupBoxConfig.Location = new Point(0, 0);
|
|
||||||
groupBoxConfig.Name = "groupBoxConfig";
|
|
||||||
groupBoxConfig.Size = new Size(514, 207);
|
|
||||||
groupBoxConfig.TabIndex = 0;
|
|
||||||
groupBoxConfig.TabStop = false;
|
|
||||||
groupBoxConfig.Text = "Параметры";
|
|
||||||
//
|
|
||||||
// groupBoxColors
|
|
||||||
//
|
|
||||||
groupBoxColors.Controls.Add(panelColorPurple);
|
|
||||||
groupBoxColors.Controls.Add(panelColorYellow);
|
|
||||||
groupBoxColors.Controls.Add(panelColorGray);
|
|
||||||
groupBoxColors.Controls.Add(panelColorGreen);
|
|
||||||
groupBoxColors.Controls.Add(panelColorWhite);
|
|
||||||
groupBoxColors.Controls.Add(panelColorBlue);
|
|
||||||
groupBoxColors.Controls.Add(panelColorBlack);
|
|
||||||
groupBoxColors.Controls.Add(panelColorRed);
|
|
||||||
groupBoxColors.Location = new Point(283, 26);
|
|
||||||
groupBoxColors.Name = "groupBoxColors";
|
|
||||||
groupBoxColors.Size = new Size(210, 114);
|
|
||||||
groupBoxColors.TabIndex = 8;
|
|
||||||
groupBoxColors.TabStop = false;
|
|
||||||
groupBoxColors.Text = "Цвет";
|
|
||||||
//
|
|
||||||
// panelColorPurple
|
|
||||||
//
|
|
||||||
panelColorPurple.BackColor = Color.Purple;
|
|
||||||
panelColorPurple.Location = new Point(168, 68);
|
|
||||||
panelColorPurple.Name = "panelColorPurple";
|
|
||||||
panelColorPurple.Size = new Size(36, 35);
|
|
||||||
panelColorPurple.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// panelColorYellow
|
|
||||||
//
|
|
||||||
panelColorYellow.BackColor = Color.Yellow;
|
|
||||||
panelColorYellow.Location = new Point(168, 22);
|
|
||||||
panelColorYellow.Name = "panelColorYellow";
|
|
||||||
panelColorYellow.Size = new Size(36, 35);
|
|
||||||
panelColorYellow.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// panelColorGray
|
|
||||||
//
|
|
||||||
panelColorGray.BackColor = Color.Gray;
|
|
||||||
panelColorGray.Location = new Point(114, 68);
|
|
||||||
panelColorGray.Name = "panelColorGray";
|
|
||||||
panelColorGray.Size = new Size(36, 35);
|
|
||||||
panelColorGray.TabIndex = 6;
|
|
||||||
//
|
|
||||||
// panelColorGreen
|
|
||||||
//
|
|
||||||
panelColorGreen.BackColor = Color.Green;
|
|
||||||
panelColorGreen.Location = new Point(114, 22);
|
|
||||||
panelColorGreen.Name = "panelColorGreen";
|
|
||||||
panelColorGreen.Size = new Size(36, 35);
|
|
||||||
panelColorGreen.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// panelColorWhite
|
|
||||||
//
|
|
||||||
panelColorWhite.BackColor = Color.White;
|
|
||||||
panelColorWhite.Location = new Point(61, 68);
|
|
||||||
panelColorWhite.Name = "panelColorWhite";
|
|
||||||
panelColorWhite.Size = new Size(36, 35);
|
|
||||||
panelColorWhite.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// panelColorBlue
|
|
||||||
//
|
|
||||||
panelColorBlue.BackColor = Color.Blue;
|
|
||||||
panelColorBlue.Location = new Point(61, 22);
|
|
||||||
panelColorBlue.Name = "panelColorBlue";
|
|
||||||
panelColorBlue.Size = new Size(36, 35);
|
|
||||||
panelColorBlue.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// panelColorBlack
|
|
||||||
//
|
|
||||||
panelColorBlack.BackColor = Color.Black;
|
|
||||||
panelColorBlack.Location = new Point(6, 68);
|
|
||||||
panelColorBlack.Name = "panelColorBlack";
|
|
||||||
panelColorBlack.Size = new Size(36, 35);
|
|
||||||
panelColorBlack.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// panelColorRed
|
|
||||||
//
|
|
||||||
panelColorRed.BackColor = Color.Red;
|
|
||||||
panelColorRed.Location = new Point(6, 22);
|
|
||||||
panelColorRed.Name = "panelColorRed";
|
|
||||||
panelColorRed.Size = new Size(36, 35);
|
|
||||||
panelColorRed.TabIndex = 0;
|
|
||||||
panelColorRed.MouseDown += panel_MouseDown;
|
|
||||||
//
|
|
||||||
// checkBoxPlatform
|
|
||||||
//
|
|
||||||
checkBoxPlatform.AutoSize = true;
|
|
||||||
checkBoxPlatform.Location = new Point(6, 135);
|
|
||||||
checkBoxPlatform.Name = "checkBoxPlatform";
|
|
||||||
checkBoxPlatform.Size = new Size(144, 19);
|
|
||||||
checkBoxPlatform.TabIndex = 7;
|
|
||||||
checkBoxPlatform.Text = "Наличие платформы";
|
|
||||||
checkBoxPlatform.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBoxCounterweight
|
|
||||||
//
|
|
||||||
checkBoxCounterweight.AutoSize = true;
|
|
||||||
checkBoxCounterweight.Location = new Point(6, 110);
|
|
||||||
checkBoxCounterweight.Name = "checkBoxCounterweight";
|
|
||||||
checkBoxCounterweight.Size = new Size(148, 19);
|
|
||||||
checkBoxCounterweight.TabIndex = 6;
|
|
||||||
checkBoxCounterweight.Text = "Наличие противовеса";
|
|
||||||
checkBoxCounterweight.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// numericUpDownWeight
|
|
||||||
//
|
|
||||||
numericUpDownWeight.Location = new Point(72, 66);
|
|
||||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
|
||||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
|
||||||
numericUpDownWeight.Size = new Size(120, 23);
|
|
||||||
numericUpDownWeight.TabIndex = 5;
|
|
||||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// numericUpDownSpeed
|
|
||||||
//
|
|
||||||
numericUpDownSpeed.Location = new Point(72, 31);
|
|
||||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
|
||||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
|
||||||
numericUpDownSpeed.Size = new Size(120, 23);
|
|
||||||
numericUpDownSpeed.TabIndex = 4;
|
|
||||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
|
||||||
//
|
|
||||||
// labelWeight
|
|
||||||
//
|
|
||||||
labelWeight.AutoSize = true;
|
|
||||||
labelWeight.Location = new Point(6, 68);
|
|
||||||
labelWeight.Name = "labelWeight";
|
|
||||||
labelWeight.Size = new Size(26, 15);
|
|
||||||
labelWeight.TabIndex = 3;
|
|
||||||
labelWeight.Text = "Вес";
|
|
||||||
//
|
|
||||||
// labelSpeed
|
|
||||||
//
|
|
||||||
labelSpeed.AutoSize = true;
|
|
||||||
labelSpeed.Location = new Point(6, 33);
|
|
||||||
labelSpeed.Name = "labelSpeed";
|
|
||||||
labelSpeed.Size = new Size(59, 15);
|
|
||||||
labelSpeed.TabIndex = 2;
|
|
||||||
labelSpeed.Text = "Скорость";
|
|
||||||
//
|
|
||||||
// labelModifiedObject
|
|
||||||
//
|
|
||||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelModifiedObject.Location = new Point(139, 173);
|
|
||||||
labelModifiedObject.Name = "labelModifiedObject";
|
|
||||||
labelModifiedObject.Size = new Size(114, 31);
|
|
||||||
labelModifiedObject.TabIndex = 1;
|
|
||||||
labelModifiedObject.Text = "Продвинутый";
|
|
||||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelModifiedObject.MouseDown += labelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// labelSimpleObject
|
|
||||||
//
|
|
||||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelSimpleObject.Location = new Point(6, 172);
|
|
||||||
labelSimpleObject.Name = "labelSimpleObject";
|
|
||||||
labelSimpleObject.Size = new Size(114, 31);
|
|
||||||
labelSimpleObject.TabIndex = 0;
|
|
||||||
labelSimpleObject.Text = "Простой";
|
|
||||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelSimpleObject.MouseDown += labelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// panel
|
|
||||||
//
|
|
||||||
panel.AllowDrop = true;
|
|
||||||
panel.Controls.Add(labelAdditionalColor);
|
|
||||||
panel.Controls.Add(labelBodyColor);
|
|
||||||
panel.Controls.Add(pictureBoxObject);
|
|
||||||
panel.Location = new Point(545, 0);
|
|
||||||
panel.Name = "panel";
|
|
||||||
panel.Size = new Size(216, 167);
|
|
||||||
panel.TabIndex = 1;
|
|
||||||
panel.DragDrop += panel_DragDrop;
|
|
||||||
panel.DragEnter += panel_DragEnter;
|
|
||||||
//
|
|
||||||
// labelAdditionalColor
|
|
||||||
//
|
|
||||||
labelAdditionalColor.AllowDrop = true;
|
|
||||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelAdditionalColor.Location = new Point(116, 9);
|
|
||||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
|
||||||
labelAdditionalColor.Size = new Size(97, 31);
|
|
||||||
labelAdditionalColor.TabIndex = 10;
|
|
||||||
labelAdditionalColor.Text = "Доп. цвет";
|
|
||||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop;
|
|
||||||
labelAdditionalColor.DragEnter += labelAdditionalColor_DragEnter;
|
|
||||||
//
|
|
||||||
// labelBodyColor
|
|
||||||
//
|
|
||||||
labelBodyColor.AllowDrop = true;
|
|
||||||
labelBodyColor.BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
labelBodyColor.Location = new Point(3, 9);
|
|
||||||
labelBodyColor.Name = "labelBodyColor";
|
|
||||||
labelBodyColor.Size = new Size(97, 31);
|
|
||||||
labelBodyColor.TabIndex = 9;
|
|
||||||
labelBodyColor.Text = "Цвет";
|
|
||||||
labelBodyColor.TextAlign = ContentAlignment.MiddleCenter;
|
|
||||||
labelBodyColor.DragDrop += labelBodyColor_DragDrop;
|
|
||||||
labelBodyColor.DragEnter += labelBodyColor_DragEnter;
|
|
||||||
//
|
|
||||||
// pictureBoxObject
|
|
||||||
//
|
|
||||||
pictureBoxObject.Location = new Point(3, 43);
|
|
||||||
pictureBoxObject.Name = "pictureBoxObject";
|
|
||||||
pictureBoxObject.Size = new Size(210, 121);
|
|
||||||
pictureBoxObject.TabIndex = 0;
|
|
||||||
pictureBoxObject.TabStop = false;
|
|
||||||
//
|
|
||||||
// buttonAdd
|
|
||||||
//
|
|
||||||
buttonAdd.Location = new Point(545, 172);
|
|
||||||
buttonAdd.Name = "buttonAdd";
|
|
||||||
buttonAdd.Size = new Size(91, 34);
|
|
||||||
buttonAdd.TabIndex = 1;
|
|
||||||
buttonAdd.Text = "Добавить";
|
|
||||||
buttonAdd.UseVisualStyleBackColor = true;
|
|
||||||
buttonAdd.Click += buttonAdd_Click;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new Point(670, 173);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new Size(91, 35);
|
|
||||||
buttonCancel.TabIndex = 2;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormCarConfig
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(777, 207);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(buttonAdd);
|
|
||||||
Controls.Add(panel);
|
|
||||||
Controls.Add(groupBoxConfig);
|
|
||||||
Name = "FormCarConfig";
|
|
||||||
Text = "FormCarConfig";
|
|
||||||
groupBoxConfig.ResumeLayout(false);
|
|
||||||
groupBoxConfig.PerformLayout();
|
|
||||||
groupBoxColors.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
|
||||||
panel.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBoxConfig;
|
|
||||||
private Label labelModifiedObject;
|
|
||||||
private Label labelSimpleObject;
|
|
||||||
private NumericUpDown numericUpDownWeight;
|
|
||||||
private NumericUpDown numericUpDownSpeed;
|
|
||||||
private Label labelWeight;
|
|
||||||
private Label labelSpeed;
|
|
||||||
private CheckBox checkBoxPlatform;
|
|
||||||
private CheckBox checkBoxCounterweight;
|
|
||||||
private GroupBox groupBoxColors;
|
|
||||||
private Panel panelColorPurple;
|
|
||||||
private Panel panelColorYellow;
|
|
||||||
private Panel panelColorGray;
|
|
||||||
private Panel panelColorGreen;
|
|
||||||
private Panel panelColorWhite;
|
|
||||||
private Panel panelColorBlue;
|
|
||||||
private Panel panelColorBlack;
|
|
||||||
private Panel panelColorRed;
|
|
||||||
private Panel panel;
|
|
||||||
private PictureBox pictureBoxObject;
|
|
||||||
private Button buttonAdd;
|
|
||||||
private Button buttonCancel;
|
|
||||||
private Label labelAdditionalColor;
|
|
||||||
private Label labelBodyColor;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,185 +0,0 @@
|
|||||||
using HoistingCrane.CollectionGenericObjects;
|
|
||||||
using HoistingCrane.Drawning;
|
|
||||||
using HoistingCrane.Entities;
|
|
||||||
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 static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
|
||||||
|
|
||||||
namespace HoistingCrane
|
|
||||||
{
|
|
||||||
public partial class FormCarConfig : Form
|
|
||||||
{
|
|
||||||
private DrawningTrackedVehicle? drawningTrackedVehicle;
|
|
||||||
private event Action<DrawningTrackedVehicle>? _carDelegate;
|
|
||||||
public FormCarConfig()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
panelColorRed.MouseDown += panel_MouseDown;
|
|
||||||
panelColorBlue.MouseDown += panel_MouseDown;
|
|
||||||
panelColorGreen.MouseDown += panel_MouseDown;
|
|
||||||
panelColorYellow.MouseDown += panel_MouseDown;
|
|
||||||
panelColorBlack.MouseDown += panel_MouseDown;
|
|
||||||
panelColorWhite.MouseDown += panel_MouseDown;
|
|
||||||
panelColorGray.MouseDown += panel_MouseDown;
|
|
||||||
panelColorPurple.MouseDown += panel_MouseDown;
|
|
||||||
buttonCancel.Click += (sender, e) => Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Привязка метода к событию
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="carDelegate"></param>
|
|
||||||
public void AddEvent(Action<DrawningTrackedVehicle> carDelegate)
|
|
||||||
{
|
|
||||||
if (carDelegate == null)
|
|
||||||
{
|
|
||||||
_carDelegate = carDelegate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_carDelegate += carDelegate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Отрисовка объекта
|
|
||||||
/// </summary>
|
|
||||||
private void DrawObject()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
drawningTrackedVehicle?.SetPictureSize(pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
drawningTrackedVehicle?.SetPosition(25, 25);
|
|
||||||
drawningTrackedVehicle?.DrawTransport(gr);
|
|
||||||
pictureBoxObject.Image = bmp;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Передаем информацию при нажатии на Label
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void labelObject_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name ?? string.Empty, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void panel_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
e.Effect = e.Data?.GetDataPresent(DataFormats.Text) ?? false ? DragDropEffects.Copy : DragDropEffects.None;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Действия при приеме перетаскиваемой информации
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void panel_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
|
||||||
{
|
|
||||||
case "labelSimpleObject":
|
|
||||||
drawningTrackedVehicle = new DrawningTrackedVehicle((int)numericUpDownSpeed.Value, (double)numericUpDownWeight.Value, Color.White);
|
|
||||||
break;
|
|
||||||
case "labelModifiedObject":
|
|
||||||
drawningTrackedVehicle = new DrawningHoistingCrane((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxCounterweight.Checked,
|
|
||||||
checkBoxPlatform.Checked);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DrawObject();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Передаем информацию при нажатии на Panel
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void panel_MouseDown(object? sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor ?? Color.White, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Передача объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (drawningTrackedVehicle != null)
|
|
||||||
{
|
|
||||||
_carDelegate?.Invoke(drawningTrackedVehicle);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Прорисовка основным цветом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void labelBodyColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (drawningTrackedVehicle == null)
|
|
||||||
return;
|
|
||||||
drawningTrackedVehicle.EntityTrackedVehicle?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
|
||||||
DrawObject();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Передача основного цвета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void labelBodyColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Прорисовка основным цветом
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (drawningTrackedVehicle?.EntityTrackedVehicle is EntityHoistingCrane entityHoistingCrane)
|
|
||||||
{
|
|
||||||
entityHoistingCrane.SetAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
|
||||||
}
|
|
||||||
DrawObject();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Передача дополнительного цвета
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void labelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (drawningTrackedVehicle is DrawningHoistingCrane)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,138 +0,0 @@
|
|||||||
using Microsoft.VisualBasic.ApplicationServices;
|
|
||||||
using System.ComponentModel.Design;
|
|
||||||
using System.Resources;
|
|
||||||
|
|
||||||
namespace HoistingCrane
|
|
||||||
{
|
|
||||||
partial class FormHoistingCrane
|
|
||||||
{
|
|
||||||
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
pictureBoxHoistingCrane = new PictureBox();
|
|
||||||
ButtonLeft = new Button();
|
|
||||||
ButtonRight = new Button();
|
|
||||||
ButtonUp = new Button();
|
|
||||||
ButtonDown = new Button();
|
|
||||||
comboStrategy = new ComboBox();
|
|
||||||
buttonStrategyStep = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxHoistingCrane).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxHoistingCrane
|
|
||||||
//
|
|
||||||
pictureBoxHoistingCrane.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxHoistingCrane.Location = new Point(0, 0);
|
|
||||||
pictureBoxHoistingCrane.Name = "pictureBoxHoistingCrane";
|
|
||||||
pictureBoxHoistingCrane.Size = new Size(818, 515);
|
|
||||||
pictureBoxHoistingCrane.TabIndex = 0;
|
|
||||||
pictureBoxHoistingCrane.TabStop = false;
|
|
||||||
//
|
|
||||||
// ButtonLeft
|
|
||||||
//
|
|
||||||
ButtonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
ButtonLeft.BackgroundImage = Properties.Resources.left_arrow;
|
|
||||||
ButtonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonLeft.Location = new Point(642, 475);
|
|
||||||
ButtonLeft.Name = "ButtonLeft";
|
|
||||||
ButtonLeft.Size = new Size(40, 40);
|
|
||||||
ButtonLeft.TabIndex = 2;
|
|
||||||
ButtonLeft.UseVisualStyleBackColor = true;
|
|
||||||
ButtonLeft.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// ButtonRight
|
|
||||||
//
|
|
||||||
ButtonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
ButtonRight.BackgroundImage = Properties.Resources.right_arrow;
|
|
||||||
ButtonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonRight.Location = new Point(734, 475);
|
|
||||||
ButtonRight.Name = "ButtonRight";
|
|
||||||
ButtonRight.Size = new Size(40, 40);
|
|
||||||
ButtonRight.TabIndex = 3;
|
|
||||||
ButtonRight.UseVisualStyleBackColor = true;
|
|
||||||
ButtonRight.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// ButtonUp
|
|
||||||
//
|
|
||||||
ButtonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
ButtonUp.BackgroundImage = Properties.Resources.up_arrow;
|
|
||||||
ButtonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonUp.Location = new Point(688, 429);
|
|
||||||
ButtonUp.Name = "ButtonUp";
|
|
||||||
ButtonUp.Size = new Size(40, 40);
|
|
||||||
ButtonUp.TabIndex = 4;
|
|
||||||
ButtonUp.UseVisualStyleBackColor = true;
|
|
||||||
ButtonUp.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// ButtonDown
|
|
||||||
//
|
|
||||||
ButtonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
ButtonDown.BackgroundImage = Properties.Resources.arrow_down_sign_to_navigate;
|
|
||||||
ButtonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
|
||||||
ButtonDown.Location = new Point(688, 475);
|
|
||||||
ButtonDown.Name = "ButtonDown";
|
|
||||||
ButtonDown.Size = new Size(40, 40);
|
|
||||||
ButtonDown.TabIndex = 5;
|
|
||||||
ButtonDown.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDown.Click += ButtonMove_Click;
|
|
||||||
//
|
|
||||||
// comboStrategy
|
|
||||||
//
|
|
||||||
comboStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
|
||||||
comboStrategy.FormattingEnabled = true;
|
|
||||||
comboStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
|
||||||
comboStrategy.Location = new Point(697, 42);
|
|
||||||
comboStrategy.Name = "comboStrategy";
|
|
||||||
comboStrategy.Size = new Size(121, 23);
|
|
||||||
comboStrategy.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonStrategyStep
|
|
||||||
//
|
|
||||||
buttonStrategyStep.Location = new Point(743, 71);
|
|
||||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
|
||||||
buttonStrategyStep.Size = new Size(75, 23);
|
|
||||||
buttonStrategyStep.TabIndex = 8;
|
|
||||||
buttonStrategyStep.Text = "Шаг";
|
|
||||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
|
||||||
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
|
||||||
//
|
|
||||||
// FormHoistingCrane
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(818, 515);
|
|
||||||
Controls.Add(buttonStrategyStep);
|
|
||||||
Controls.Add(comboStrategy);
|
|
||||||
Controls.Add(ButtonDown);
|
|
||||||
Controls.Add(ButtonUp);
|
|
||||||
Controls.Add(ButtonRight);
|
|
||||||
Controls.Add(ButtonLeft);
|
|
||||||
Controls.Add(pictureBoxHoistingCrane);
|
|
||||||
Name = "FormHoistingCrane";
|
|
||||||
Text = "Подъемный кран";
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxHoistingCrane).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxHoistingCrane;
|
|
||||||
private Button ButtonLeft;
|
|
||||||
private Button ButtonRight;
|
|
||||||
private Button ButtonUp;
|
|
||||||
private Button ButtonDown;
|
|
||||||
private ComboBox comboStrategy;
|
|
||||||
private Button buttonStrategyStep;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
using HoistingCrane.Drawning;
|
|
||||||
using HoistingCrane.MovementStrategy;
|
|
||||||
|
|
||||||
namespace HoistingCrane
|
|
||||||
{
|
|
||||||
public partial class FormHoistingCrane : Form
|
|
||||||
{
|
|
||||||
|
|
||||||
private DrawningTrackedVehicle? _drawning;
|
|
||||||
private AbstractStrategy? _abstractStrategy;
|
|
||||||
public FormHoistingCrane()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_abstractStrategy = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawningTrackedVehicle? SetCar
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_drawning = value;
|
|
||||||
_drawning?.SetPictureSize(pictureBoxHoistingCrane.Width, pictureBoxHoistingCrane.Height);
|
|
||||||
comboStrategy.Enabled = true;
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(pictureBoxHoistingCrane.Width, pictureBoxHoistingCrane.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawning?.DrawTransport(gr);
|
|
||||||
pictureBoxHoistingCrane.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawning == null) { return; }
|
|
||||||
String name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
bool result = false;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "ButtonUp":
|
|
||||||
result = _drawning.MoveTransport(DirectionType.Up);
|
|
||||||
break;
|
|
||||||
case "ButtonDown":
|
|
||||||
result = _drawning.MoveTransport(DirectionType.Down);
|
|
||||||
break;
|
|
||||||
case "ButtonRight":
|
|
||||||
result = _drawning.MoveTransport(DirectionType.Right);
|
|
||||||
break;
|
|
||||||
case "ButtonLeft":
|
|
||||||
result = _drawning.MoveTransport(DirectionType.Left);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonStrategyStep_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawning == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (comboStrategy.Enabled)
|
|
||||||
{
|
|
||||||
_abstractStrategy = comboStrategy.SelectedIndex switch
|
|
||||||
{
|
|
||||||
0 => new MoveToCenter(),
|
|
||||||
1 => new MoveToBorder(),
|
|
||||||
_ => null,
|
|
||||||
};
|
|
||||||
if (_abstractStrategy == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_abstractStrategy.SetData(new MoveableCar(_drawning), pictureBoxHoistingCrane.Width, pictureBoxHoistingCrane.Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_abstractStrategy == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
comboStrategy.Enabled = false;
|
|
||||||
_abstractStrategy.MakeStep();
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
if (_abstractStrategy.GetStatus() == StrategyStatus.Finish)
|
|
||||||
{
|
|
||||||
comboStrategy.Enabled = true;
|
|
||||||
_abstractStrategy = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -8,35 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove="CollectionGenericObjects\MassivGenericObjects.cs~RF2955bcc.TMP" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11" />
|
|
||||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
|
||||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
@ -1,137 +0,0 @@
|
|||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public abstract class AbstractStrategy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещаемый объект
|
|
||||||
/// </summary>
|
|
||||||
private IMoveableObjects? _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>
|
|
||||||
/// <returns></returns>
|
|
||||||
public StrategyStatus GetStatus() { return _state; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Установка данных
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
|
||||||
/// <param name="width">Ширина поля</param>
|
|
||||||
/// <param name="height">Высота поля</param>
|
|
||||||
public void SetData(IMoveableObjects 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 (IsTargetDestination())
|
|
||||||
{
|
|
||||||
_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 IsTargetDestination();
|
|
||||||
/// <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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public interface IMoveableObjects
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Получение позиции объекта
|
|
||||||
/// </summary>
|
|
||||||
ObjectParameters? GetObjectPosition { get; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение шага объекта
|
|
||||||
/// </summary>
|
|
||||||
int GetStep { get; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Попытка переместить объект в указанном направлении
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">направление</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
bool TryMoveObject(MovementDirection direction);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
using System.Configuration;
|
|
||||||
|
|
||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public class MoveToBorder : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestination()
|
|
||||||
{
|
|
||||||
ObjectParameters? objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return objParams.RightBorder + GetStep() >= FieldWidth && 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
namespace HoistingCrane.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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
using HoistingCrane.Drawning;
|
|
||||||
|
|
||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public class MoveableCar : IMoveableObjects
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Поле-объект класса DrawningAirplane или его наследника
|
|
||||||
/// </summary>
|
|
||||||
private readonly DrawningTrackedVehicle? drawningTrackedVehicle = null;
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="airplane">Объект класса DrawningAirplane</param>
|
|
||||||
public MoveableCar(DrawningTrackedVehicle drawningTrackedVehicle)
|
|
||||||
{
|
|
||||||
this.drawningTrackedVehicle = drawningTrackedVehicle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectParameters? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (drawningTrackedVehicle == null || drawningTrackedVehicle.EntityTrackedVehicle == null || !drawningTrackedVehicle.GetPosX.HasValue || !drawningTrackedVehicle.GetPosY.HasValue)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ObjectParameters(drawningTrackedVehicle.GetPosX.Value, drawningTrackedVehicle.GetPosY.Value, drawningTrackedVehicle.GetWidth, drawningTrackedVehicle.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int GetStep => (int)(drawningTrackedVehicle?.EntityTrackedVehicle?.Step ?? 0);
|
|
||||||
|
|
||||||
public bool TryMoveObject(MovementDirection direction)
|
|
||||||
{
|
|
||||||
if (drawningTrackedVehicle == null || drawningTrackedVehicle.EntityTrackedVehicle == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return drawningTrackedVehicle.MoveTransport(GetDirectionType(direction));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Конвертация из MovementDirection в DirectionType
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">MovementDirection</param>
|
|
||||||
/// <returns>DirectionType</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,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public enum MovementDirection
|
|
||||||
{
|
|
||||||
//Перечислим основные траектории движния нашего автомобиля. Сразу же зададим значения.
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх1
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public class ObjectParameters
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Начальная координата х
|
|
||||||
/// </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 RightBorder => _x + _width;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Верхняя граница
|
|
||||||
/// </summary>
|
|
||||||
public int TopBorder => _y;
|
|
||||||
|
|
||||||
/// <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)
|
|
||||||
{
|
|
||||||
this._x = _x;
|
|
||||||
this._y = _y;
|
|
||||||
this._width = _width;
|
|
||||||
this._height = _height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
namespace HoistingCrane.MovementStrategy
|
|
||||||
{
|
|
||||||
public enum StrategyStatus
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Всё готово к началу
|
|
||||||
/// </summary>
|
|
||||||
NotInit,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Выполняется
|
|
||||||
/// </summary>
|
|
||||||
InProgress,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Завершено
|
|
||||||
/// </summary>
|
|
||||||
Finish
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,7 @@
|
|||||||
namespace HoistingCrane;
|
namespace HoistingCrane
|
||||||
|
|
||||||
internal static class Program
|
|
||||||
{
|
{
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -11,6 +11,7 @@ internal static class Program
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormCarCollection());
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace HoistingCrane.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("HoistingCrane.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 arrow_down_sign_to_navigate {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("arrow-down-sign-to-navigate", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap left_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("left-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap right_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("right-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap up_arrow {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("up-arrow", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="right-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\right-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="left-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\left-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="up-arrow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\up-arrow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="arrow-down-sign-to-navigate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\arrow-down-sign-to-navigate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue
Block a user