Лабораторная работа 3
This commit is contained in:
parent
4ae1974f26
commit
34308d5707
117
Lab1/Lab1/CollectionGenericObjects/AbstractCompany.cs
Normal file
117
Lab1/Lab1/CollectionGenericObjects/AbstractCompany.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Lab1.Drawnings;
|
||||
namespace Lab1.CollectionGenericObjects;
|
||||
|
||||
public abstract class AbstractCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Размер места (ширина)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeWidth = 180;
|
||||
|
||||
/// <summary>
|
||||
/// Размер места (высота)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeHeight = 90;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Коллекция автомобилей
|
||||
/// </summary>
|
||||
protected ICollectionGenericObjects<DrawningTruck>? _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<DrawningTruck> collection)
|
||||
{
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = collection;
|
||||
_collection.SetMaxCount = GetMaxCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перегрузка оператора сложения для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="car">Добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static int operator +(AbstractCompany company, DrawningTruck truck)
|
||||
{
|
||||
return company._collection.Insert(truck);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перегрузка оператора удаления для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="position">Номер удаляемого объекта</param>
|
||||
/// <returns></returns>
|
||||
public static DrawningTruck operator -(AbstractCompany company, int position)
|
||||
{
|
||||
return company._collection?.Remove(position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение случайного объекта из коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DrawningTruck? GetRandomObject()
|
||||
{
|
||||
Random rnd = new();
|
||||
return _collection?.Get(rnd.Next(GetMaxCount));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вывод всей коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap? Show()
|
||||
{
|
||||
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
|
||||
Graphics graphics = Graphics.FromImage(bitmap);
|
||||
DrawBackgound(graphics);
|
||||
|
||||
SetObjectsPosition();
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||
{
|
||||
DrawningTruck? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Вывод заднего фона
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
protected abstract void DrawBackgound(Graphics g);
|
||||
|
||||
/// <summary>
|
||||
/// Расстановка объектов
|
||||
/// </summary>
|
||||
protected abstract void SetObjectsPosition();
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Lab1.CollectionGenericObjects;
|
||||
|
||||
public interface ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// колличество объектов в коллекции
|
||||
/// </summary>
|
||||
int Count { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка максимального количества элементов
|
||||
/// </summary>
|
||||
int SetMaxCount { set; }
|
||||
|
||||
/// <summary>
|
||||
/// Добавление объекта в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="obj">Добавляемый объект</param>
|
||||
/// <returns>true - вставка прошла удачно, false - вставка не удалась</returns>
|
||||
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);
|
||||
}
|
116
Lab1/Lab1/CollectionGenericObjects/MassiveGenericObjects.cs
Normal file
116
Lab1/Lab1/CollectionGenericObjects/MassiveGenericObjects.cs
Normal file
@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Lab1.CollectionGenericObjects;
|
||||
|
||||
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
||||
where T : class
|
||||
{
|
||||
/// <summary>
|
||||
/// массив объектов, которые храним
|
||||
/// </summary>
|
||||
private T?[] _collection;
|
||||
public int Count => _collection.Length;
|
||||
|
||||
public int SetMaxCount
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
if (_collection.Length > 0)
|
||||
{
|
||||
Array.Resize(ref _collection, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
_collection = new T?[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public MassiveGenericObjects()
|
||||
{
|
||||
_collection = Array.Empty<T?>();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{ return null; }
|
||||
return _collection[position];
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
// TODO вставка в свободное место набора
|
||||
int index = 0;
|
||||
while (index < _collection.Length)
|
||||
{
|
||||
if (_collection[index] == null)
|
||||
{
|
||||
_collection[index] = obj;
|
||||
return index;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO проверка, что элемент массива по этой позиции пустой, если нет, то
|
||||
// ищется свободное место после этой позиции и идет вставка туда
|
||||
// если нет после, ищем до
|
||||
// TODO вставка
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{ return -1; }
|
||||
|
||||
if (_collection[position] == null)
|
||||
{
|
||||
_collection[position] = obj;
|
||||
return position;
|
||||
}
|
||||
int index;
|
||||
|
||||
for (index = position + 1; index < _collection.Length; ++index)
|
||||
{
|
||||
if (_collection[index] == null)
|
||||
{
|
||||
_collection[position] = obj;
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
||||
for (index = position - 1; index >= 0; --index)
|
||||
{
|
||||
if (_collection[index] == null)
|
||||
{
|
||||
_collection[position] = obj;
|
||||
return position;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public T Remove(int position)
|
||||
{
|
||||
// TODO проверка позиции
|
||||
// TODO удаление объекта из массива, присвоив элементу массива значение null
|
||||
if (position >= _collection.Length || position < 0)
|
||||
{ return null; }
|
||||
T obj = _collection[position];
|
||||
_collection[position] = null;
|
||||
return obj;
|
||||
}
|
||||
}
|
49
Lab1/Lab1/CollectionGenericObjects/TruckPark.cs
Normal file
49
Lab1/Lab1/CollectionGenericObjects/TruckPark.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Lab1.Drawnings;
|
||||
namespace Lab1.CollectionGenericObjects;
|
||||
|
||||
public class TruckPark : AbstractCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth"></param>
|
||||
/// <param name="picHeight"></param>
|
||||
/// <param name="collection"></param>
|
||||
public TruckPark(int picWidth, int picHeight, ICollectionGenericObjects<DrawningTruck> collection) : base(picWidth, picHeight, collection)
|
||||
{
|
||||
}
|
||||
//TO DO
|
||||
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, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 15, j * _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TO DO
|
||||
protected override void SetObjectsPosition()
|
||||
{
|
||||
int count = 0;
|
||||
for (int y = 5; y + 50 < _pictureHeight; y += 90)
|
||||
{
|
||||
for (int x = 5; x + 200 < _pictureWidth; x += _placeSizeHeight + 90)
|
||||
{
|
||||
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection?.Get(count)?.SetPosition(x, y);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -28,8 +28,10 @@ public class DrawningRoadTrain : DrawningTruck
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
/// <summary>
|
||||
/// переопределение метода DrawTransport
|
||||
/// </summary>
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTruck == null || EntityTruck is not EntityRoadTrain roadTrain || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ public class DrawningTruck
|
||||
public int GetHeight => _drawningCarHeight;
|
||||
|
||||
|
||||
private DrawningTruck()
|
||||
public DrawningTruck()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
|
41
Lab1/Lab1/FormRoadTrain.Designer.cs
generated
41
Lab1/Lab1/FormRoadTrain.Designer.cs
generated
@ -8,7 +8,7 @@
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// Переопределение метода Dispose.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)
|
||||
@ -28,29 +28,16 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
buttonCreate = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonDown = new Button();
|
||||
pictureBoxYborshik = new PictureBox();
|
||||
buttonCreateTruck = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxYborshik).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(2, 428);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(327, 29);
|
||||
buttonCreate.TabIndex = 0;
|
||||
buttonCreate.Text = "Создать подметально-уборочную машину\r\n";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
@ -61,7 +48,7 @@
|
||||
buttonLeft.Size = new Size(35, 35);
|
||||
buttonLeft.TabIndex = 1;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += buttonMove_Click;
|
||||
buttonLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
@ -73,7 +60,7 @@
|
||||
buttonUp.Size = new Size(35, 35);
|
||||
buttonUp.TabIndex = 2;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += buttonMove_Click;
|
||||
buttonUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
@ -85,7 +72,7 @@
|
||||
buttonRight.Size = new Size(35, 35);
|
||||
buttonRight.TabIndex = 3;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
buttonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
@ -97,7 +84,7 @@
|
||||
buttonDown.Size = new Size(35, 35);
|
||||
buttonDown.TabIndex = 4;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += buttonMove_Click;
|
||||
buttonDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// pictureBoxYborshik
|
||||
//
|
||||
@ -108,17 +95,6 @@
|
||||
pictureBoxYborshik.TabIndex = 5;
|
||||
pictureBoxYborshik.TabStop = false;
|
||||
//
|
||||
// buttonCreateTruck
|
||||
//
|
||||
buttonCreateTruck.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateTruck.Location = new Point(335, 425);
|
||||
buttonCreateTruck.Name = "buttonCreateTruck";
|
||||
buttonCreateTruck.Size = new Size(141, 29);
|
||||
buttonCreateTruck.TabIndex = 6;
|
||||
buttonCreateTruck.Text = "Создать грузовик";
|
||||
buttonCreateTruck.UseVisualStyleBackColor = true;
|
||||
buttonCreateTruck.Click += buttonCreateTruck_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
@ -137,7 +113,7 @@
|
||||
buttonStrategyStep.TabIndex = 8;
|
||||
buttonStrategyStep.Text = "Шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += buttonStrategyStep_Click;
|
||||
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
||||
//
|
||||
// FormRoadTrain
|
||||
//
|
||||
@ -146,12 +122,10 @@
|
||||
ClientSize = new Size(851, 456);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonCreateTruck);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(pictureBoxYborshik);
|
||||
Name = "FormRoadTrain";
|
||||
Text = "FormYborshik";
|
||||
@ -160,14 +134,11 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonCreate;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonRight;
|
||||
private Button buttonDown;
|
||||
private PictureBox pictureBoxYborshik;
|
||||
private Button buttonCreateTruck;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
|
@ -28,6 +28,18 @@ namespace Lab1
|
||||
/// </summary>
|
||||
private AbstractStrategy? _strategy;
|
||||
|
||||
public DrawningTruck SetTruck
|
||||
{
|
||||
set
|
||||
{
|
||||
_drawningTruck = value;
|
||||
_drawningTruck.SetPictureSize(pictureBoxYborshik.Width, pictureBoxYborshik.Height);
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор формы
|
||||
/// </summary>
|
||||
@ -50,53 +62,8 @@ namespace Lab1
|
||||
pictureBoxYborshik.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта класса-перемещения
|
||||
/// </summary>
|
||||
/// <param name="type">Тип создаваемого объекта</param>
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
Random random = new();
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningTruck):
|
||||
_drawningTruck = new DrawningTruck(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
break;
|
||||
case nameof(DrawningRoadTrain):
|
||||
_drawningTruck = new DrawningRoadTrain(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
_drawningTruck.SetPictureSize(pictureBoxYborshik.Width, pictureBoxYborshik.Height);
|
||||
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_strategy = null;
|
||||
comboBoxStrategy.Enabled = true;
|
||||
Draw();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateObject(nameof(DrawningRoadTrain));
|
||||
}
|
||||
private void buttonCreateTruck_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateObject(nameof(DrawningTruck));
|
||||
}
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningTruck == null)
|
||||
{
|
||||
@ -127,7 +94,7 @@ namespace Lab1
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStrategyStep_Click(object sender, EventArgs e)
|
||||
private void ButtonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningTruck == null)
|
||||
{
|
||||
|
173
Lab1/Lab1/FormTruckCollection.Designer.cs
generated
Normal file
173
Lab1/Lab1/FormTruckCollection.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
||||
namespace Lab1
|
||||
{
|
||||
partial class FormTruckCollection
|
||||
{
|
||||
/// <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();
|
||||
buttonRefresh = new Button();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonRemoveTruck = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonAddRoadTrain = new Button();
|
||||
buttonAddTruck = new Button();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(buttonRefresh);
|
||||
groupBoxTools.Controls.Add(buttonGoToCheck);
|
||||
groupBoxTools.Controls.Add(buttonRemoveTruck);
|
||||
groupBoxTools.Controls.Add(maskedTextBoxPosition);
|
||||
groupBoxTools.Controls.Add(buttonAddRoadTrain);
|
||||
groupBoxTools.Controls.Add(buttonAddTruck);
|
||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBoxTools.Dock = DockStyle.Right;
|
||||
groupBoxTools.Location = new Point(807, 0);
|
||||
groupBoxTools.Name = "groupBoxTools";
|
||||
groupBoxTools.Size = new Size(242, 628);
|
||||
groupBoxTools.TabIndex = 0;
|
||||
groupBoxTools.TabStop = false;
|
||||
groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRefresh.Location = new Point(16, 423);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(214, 58);
|
||||
buttonRefresh.TabIndex = 6;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToCheck.Location = new Point(16, 333);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(214, 58);
|
||||
buttonGoToCheck.TabIndex = 5;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||
//
|
||||
// buttonRemoveTruck
|
||||
//
|
||||
buttonRemoveTruck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonRemoveTruck.Location = new Point(16, 248);
|
||||
buttonRemoveTruck.Name = "buttonRemoveTruck";
|
||||
buttonRemoveTruck.Size = new Size(214, 58);
|
||||
buttonRemoveTruck.TabIndex = 4;
|
||||
buttonRemoveTruck.Text = "Удалить грузовик";
|
||||
buttonRemoveTruck.UseVisualStyleBackColor = true;
|
||||
buttonRemoveTruck.Click += ButtonRemoveCar_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Location = new Point(16, 215);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(214, 27);
|
||||
maskedTextBoxPosition.TabIndex = 3;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonAddRoadTrain
|
||||
//
|
||||
buttonAddRoadTrain.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddRoadTrain.Location = new Point(16, 133);
|
||||
buttonAddRoadTrain.Name = "buttonAddRoadTrain";
|
||||
buttonAddRoadTrain.Size = new Size(214, 58);
|
||||
buttonAddRoadTrain.TabIndex = 2;
|
||||
buttonAddRoadTrain.Text = "Добавление грузовика с дополнениями";
|
||||
buttonAddRoadTrain.UseVisualStyleBackColor = true;
|
||||
buttonAddRoadTrain.Click += ButtonAddRoadTrain_Click;
|
||||
//
|
||||
// buttonAddTruck
|
||||
//
|
||||
buttonAddTruck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddTruck.Location = new Point(16, 98);
|
||||
buttonAddTruck.Name = "buttonAddTruck";
|
||||
buttonAddTruck.Size = new Size(214, 29);
|
||||
buttonAddTruck.TabIndex = 1;
|
||||
buttonAddTruck.Text = "Добавление грузовика";
|
||||
buttonAddTruck.UseVisualStyleBackColor = true;
|
||||
buttonAddTruck.Click += ButtonAddTruck_Click;
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(16, 26);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(214, 28);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.Click += ComboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(807, 628);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// FormTruckCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1049, 628);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBoxTools);
|
||||
Name = "FormTruckCollection";
|
||||
Text = "Коллекция грузовиков";
|
||||
groupBoxTools.ResumeLayout(false);
|
||||
groupBoxTools.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxTools;
|
||||
private Button buttonAddTruck;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private Button buttonAddRoadTrain;
|
||||
private PictureBox pictureBox;
|
||||
private Button buttonRemoveTruck;
|
||||
private Button buttonGoToCheck;
|
||||
private Button buttonRefresh;
|
||||
}
|
||||
}
|
195
Lab1/Lab1/FormTruckCollection.cs
Normal file
195
Lab1/Lab1/FormTruckCollection.cs
Normal file
@ -0,0 +1,195 @@
|
||||
using Lab1.CollectionGenericObjects;
|
||||
using Lab1.Drawnings;
|
||||
using Lab1.MovementStrategy;
|
||||
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;
|
||||
|
||||
namespace Lab1;
|
||||
|
||||
public partial class FormTruckCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
AbstractCompany? _company = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormTruckCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Выбор компании
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new TruckPark(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningTruck>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление обычного автомобиля
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddTruck_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTruck));
|
||||
|
||||
/// <summary>
|
||||
/// Добавление спортивного автомобиля
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddRoadTrain_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningRoadTrain));
|
||||
|
||||
/// <summary>
|
||||
/// Создание объекта класса-перемещения
|
||||
/// </summary>
|
||||
/// <param name="type">Тип создаваемого объекта</param>
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Random random = new();
|
||||
DrawningTruck drawningTruck;
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningTruck):
|
||||
drawningTruck = new DrawningTruck(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
|
||||
break;
|
||||
case nameof(DrawningRoadTrain):
|
||||
// TODO вызов диалогового окна для выбора цвета
|
||||
drawningTruck = new DrawningRoadTrain(random.Next(100, 300), random.Next(1000, 3000),
|
||||
GetColor(random),
|
||||
GetColor(random),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (_company + drawningTruck != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение цвета
|
||||
/// </summary>
|
||||
/// <param name="random">Генератор случайных чисел</param>
|
||||
/// <returns></returns>
|
||||
private static Color GetColor(Random random)
|
||||
{
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonRemoveCar_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if (_company - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передача объекта в другую форму
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonGoToCheck_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawningTruck? truck = null;
|
||||
int counter = 100;
|
||||
while (truck == null)
|
||||
{
|
||||
truck = _company.GetRandomObject();
|
||||
counter--;
|
||||
if (counter <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (truck == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormRoadTrain form = new()
|
||||
{
|
||||
SetTruck = truck
|
||||
};
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перерисовка коллекции
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
}
|
120
Lab1/Lab1/FormTruckCollection.resx
Normal file
120
Lab1/Lab1/FormTruckCollection.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -34,7 +34,7 @@ public abstract class AbstractStrategy
|
||||
public StrategyStatus GetStatus() { return _state; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка данных
|
||||
/// Установка данных c полиморфизмом подтипов
|
||||
/// </summary>
|
||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
@ -126,7 +126,7 @@ public abstract class AbstractStrategy
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
|
||||
/// <summary>
|
||||
/// Попытка перемещения в требуемом направлении
|
||||
/// Попытка перемещения в требуемом направлении c полиморфизмом подтипов
|
||||
/// </summary>
|
||||
/// <param name="movementDirection">Направление</param>
|
||||
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||
|
@ -8,6 +8,9 @@ namespace Lab1.MovementStrategy;
|
||||
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Переопределение метода IsTargetDestinaion
|
||||
/// </summary>
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objectparams = GetObjectParameters;
|
||||
@ -21,6 +24,9 @@ public class MoveToBorder : AbstractStrategy
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Переопределение метода MoveToTarget
|
||||
/// </summary>
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objectparams = GetObjectParameters;
|
||||
|
@ -8,6 +8,9 @@ namespace Lab1.MovementStrategy;
|
||||
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Переопределение метода IsTargetDestinaion
|
||||
/// </summary>
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
@ -19,7 +22,9 @@ public class MoveToCenter : AbstractStrategy
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Переопределение метода MoveToTarget
|
||||
/// </summary>
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
|
@ -62,7 +62,6 @@ public class MoveableTruck : IMoveableObjectcs
|
||||
MovementDirection.Right => DirectionType.Right,
|
||||
MovementDirection.Up => DirectionType.Up,
|
||||
MovementDirection.Down => DirectionType.Down,
|
||||
_ => DirectionType.Unknow,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace Lab1
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormRoadTrain());
|
||||
Application.Run(new FormTruckCollection());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user