WIP: Pibd11_Kirilin_V.A._Base_LabWork03 #3
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32014.148
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocomativeProject", "LocomativeProject\LocomativeProject.csproj", "{31F7DD61-7F62-4B39-8543-7A917369587A}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocomotiveProject", "LocomativeProject\LocomotiveProject.csproj", "{31F7DD61-7F62-4B39-8543-7A917369587A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -0,0 +1,113 @@
|
||||
using LocomativeProject.Drawnings;
|
||||
using LocomotiveProject.CollectionGenericObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LocomotiveProject.CollectionGenericObjects;
|
||||
/// <summary>
|
||||
/// Абстракция компании,хранящий коллекцию круизеров
|
||||
/// </summary>
|
||||
public abstract class AbstractCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Размер места(ширина)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeWidth = 210;
|
||||
/// <summary>
|
||||
/// Размер места(высота)
|
||||
/// </summary>
|
||||
protected readonly int _placeSizeHeight = 120;
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureWidth;
|
||||
/// <summary>
|
||||
/// Высота окна
|
||||
/// </summary>
|
||||
protected readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Коллекцияя круизеров
|
||||
/// </summary>
|
||||
protected ICollectionGenericObjects<DrawningBaseLocomotive> _collection = null;
|
||||
/// <summary>
|
||||
/// Вычисление макс кол-ва элементов,который можно разместить в окне
|
||||
/// </summary>
|
||||
private int GetMaxCount => _pictureWidth / _placeSizeWidth * (_pictureHeight / _placeSizeHeight);
|
||||
/// <summary>
|
||||
/// конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth">Ширина окна</param>
|
||||
/// <param name="pictureHeight">Высота окна</param>
|
||||
/// <param name="collection">коллекция</param>
|
||||
public AbstractCompany(int picWidth, int pictureHeight,ICollectionGenericObjects<DrawningBaseLocomotive> collection)
|
||||
{
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
_collection = collection;
|
||||
_collection.SetMaxCount = GetMaxCount;
|
||||
}
|
||||
/// <summary>
|
||||
/// перегрузка оператора + для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="Locomotive">добавляемый объект</param>
|
||||
/// <returns></returns>
|
||||
public static int operator +(AbstractCompany company, DrawningBaseLocomotive Locomotive)
|
||||
{
|
||||
if (company._collection == null)
|
||||
return -1;
|
||||
return company._collection.Insert(Locomotive);
|
||||
}
|
||||
/// <summary>
|
||||
/// перегрузка оператора - для класса
|
||||
/// </summary>
|
||||
/// <param name="company">Компания</param>
|
||||
/// <param name="position">позиция удаления</param>
|
||||
/// <returns></returns>
|
||||
public static DrawningBaseLocomotive operator -(AbstractCompany company, int position)
|
||||
{
|
||||
if (company._collection == null)
|
||||
return null;
|
||||
|
||||
return company._collection.Remove(position);
|
||||
}
|
||||
/// <summary>
|
||||
/// получение случайног обьекта из коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DrawningBaseLocomotive? GetRandomObject()
|
||||
{
|
||||
Random rnd = new Random();
|
||||
return _collection?.Get(rnd.Next(GetMaxCount));
|
||||
}
|
||||
/// <summary>
|
||||
/// вывод всей коллекции
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap? Show()
|
||||
{
|
||||
Bitmap? bitmap = new(_pictureWidth,_pictureHeight);
|
||||
Graphics graphics = Graphics.FromImage(bitmap);
|
||||
DrawBackground(graphics);
|
||||
|
||||
SetObjectPosition();
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||
{
|
||||
DrawningBaseLocomotive? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
/// <summary>
|
||||
/// Вывод заднего фона
|
||||
/// </summary>
|
||||
/// <param name="graphics"></param>
|
||||
protected abstract void DrawBackground(Graphics graphics);
|
||||
/// <summary>
|
||||
/// Расстановка объектов
|
||||
/// </summary>
|
||||
protected abstract void SetObjectPosition();
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LocomotiveProject.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="positon">позиция</param>
|
||||
/// <returns>true-удаление прошло удачно,false- удаление не удалось</returns>
|
||||
T? Remove(int positon);
|
||||
/// <summary>
|
||||
/// получение объекта по позиции
|
||||
/// </summary>
|
||||
/// <param name="positon">позиция</param>
|
||||
/// <returns>Обьект</returns>
|
||||
T? Get(int positon);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using LocomativeProject.Drawnings;
|
||||
using LocomotiveProject.CollectionGenericObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LocomotiveProject.CollectionGenericObjects;
|
||||
|
||||
public class LocomotiveSharingService : AbstractCompany
|
||||
{
|
||||
public LocomotiveSharingService(int picWidth, int pictureHeight, ICollectionGenericObjects<DrawningBaseLocomotive> collection) : base(picWidth, pictureHeight, collection)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DrawBackground(Graphics g)
|
||||
{
|
||||
Pen pen = new Pen(Color.Black,2);
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
for (int j = 0; j < height; j++)
|
||||
{
|
||||
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
|
||||
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
|
||||
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetObjectPosition()
|
||||
{
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int curWidth = 0;
|
||||
int curHeight = 0;
|
||||
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||
{
|
||||
if (_collection?.Get(i) != null)
|
||||
{
|
||||
_collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
|
||||
}
|
||||
if (curHeight < height - 1)
|
||||
curHeight++;
|
||||
else
|
||||
{
|
||||
curHeight = 0;
|
||||
curWidth++;
|
||||
}
|
||||
if (curWidth > width - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using LocomativeProject.Drawnings;
|
||||
using LocomotiveProject.CollectionGenericObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LocomotiveProject.CollectionGenericObjects;
|
||||
|
||||
public class LocomotiveDock : AbstractCompany
|
||||
{
|
||||
public LocomotiveDock(int picWidth, int pictureHeight, ICollectionGenericObjects<DrawningBaseLocomotive> collection) : base(picWidth, pictureHeight, collection)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DrawBackground(Graphics g)
|
||||
{
|
||||
Pen pen = new Pen(Color.Black,2);
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
for (int j = 0; j < height; j++)
|
||||
{
|
||||
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
|
||||
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
|
||||
g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetObjectPosition()
|
||||
{
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int curWidth = 0;
|
||||
int curHeight = 0;
|
||||
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||
{
|
||||
if (_collection?.Get(i) != null)
|
||||
{
|
||||
_collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
|
||||
}
|
||||
if (curHeight < height - 1)
|
||||
curHeight++;
|
||||
else
|
||||
{
|
||||
curHeight = 0;
|
||||
curWidth++;
|
||||
}
|
||||
if (curWidth > width - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LocomotiveProject.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) { _collection = new T?[value]; } } }
|
||||
/// <summary>
|
||||
/// конструктор
|
||||
/// </summary>
|
||||
public MassiveGenericObjects()
|
||||
{
|
||||
_collection = Array.Empty<T>();
|
||||
}
|
||||
|
||||
public T? Get(int positon)
|
||||
{
|
||||
if (positon <= Count || positon > 0)
|
||||
{
|
||||
return _collection[positon];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (_collection[i] == null )
|
||||
{
|
||||
_collection[i] = obj;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
if (_collection[position]== null)
|
||||
{
|
||||
_collection[position] = obj;
|
||||
return position;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = position; i < Count; i++)
|
||||
{
|
||||
if (_collection[i] == null)
|
||||
{
|
||||
_collection[i] = obj;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (int i = Count -1; i > 0; i--)
|
||||
{
|
||||
if (_collection[i] == null)
|
||||
{
|
||||
_collection[i] = obj;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public T? Remove(int position)
|
||||
{
|
||||
if (position >= Count || position < 0) return null;
|
||||
if (_collection[position] != null)
|
||||
{
|
||||
T obj = _collection[position];
|
||||
_collection[position] = null;
|
||||
return obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using LocomotiveProject.Drawnings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LocomotiveProject.CollectionGenericObjects
|
||||
{
|
||||
/// <summary>
|
||||
/// Параметризованный класс
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class parameterizedClass<T> where T : DrawningLocomotive { }
|
||||
}
|
@ -32,12 +32,12 @@ namespace LocomativeProject.Drawnings
|
||||
/// <summary>
|
||||
/// Ширина прорисовки тепловоза
|
||||
/// </summary>
|
||||
private readonly int _drawningBaseLocomotiveWidth = 120;
|
||||
private readonly int _drawningBaseLocomotiveWidth = 150;
|
||||
|
||||
/// <summary>
|
||||
/// Высота прорисовки тепловоза
|
||||
/// </summary>
|
||||
private readonly int _drawningBaseLocomotiveHeight = 60;
|
||||
private readonly int _drawningBaseLocomotiveHeight = 80;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -31,19 +31,19 @@ namespace LocomotiveProject.Drawnings
|
||||
Brush bodyBrush = new SolidBrush(entityLocomotive.BodyColor);
|
||||
//Brush blackBrush = new SolidBrush(Color.Black);
|
||||
//Brush whiteBrush = new SolidBrush(Color.White);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
|
||||
//g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 20 + 10, 110, 20);
|
||||
base.DrawTransport(g);
|
||||
if (entityLocomotive.ExehaustPipe)
|
||||
{
|
||||
Brush greyBrush = new SolidBrush(Color.Gray);
|
||||
g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value, 5, 10);
|
||||
}
|
||||
// отсек для топлива
|
||||
if (entityLocomotive.FuelCompartment)
|
||||
{
|
||||
g.FillRectangle(bodyBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
|
||||
g.FillRectangle(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
namespace LocomativeProject
|
||||
namespace LocomotiveProject
|
||||
{
|
||||
partial class LocomotiveProject
|
||||
{
|
||||
@ -29,163 +29,131 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProject));
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
|
||||
this.buttonCreateBaseLocomotive = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.buttonCreateLocomotive = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.buttonStrategyStep = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
pictureBox1 = new PictureBox();
|
||||
pictureBoxLocomotive = new PictureBox();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonRight = new Button();
|
||||
comboBox1 = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(100, 50);
|
||||
this.pictureBox1.TabIndex = 0;
|
||||
this.pictureBox1.TabStop = false;
|
||||
pictureBox1.Location = new Point(0, 0);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(100, 50);
|
||||
pictureBox1.TabIndex = 0;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// pictureBoxLocomotive
|
||||
//
|
||||
this.pictureBoxLocomotive.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxLocomotive.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxLocomotive.Name = "pictureBoxLocomotive";
|
||||
this.pictureBoxLocomotive.Size = new System.Drawing.Size(800, 450);
|
||||
this.pictureBoxLocomotive.TabIndex = 1;
|
||||
this.pictureBoxLocomotive.TabStop = false;
|
||||
//
|
||||
// buttonCreateBaseLocomotive
|
||||
//
|
||||
this.buttonCreateBaseLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateBaseLocomotive.Location = new System.Drawing.Point(12, 415);
|
||||
this.buttonCreateBaseLocomotive.Name = "buttonCreateBaseLocomotive";
|
||||
this.buttonCreateBaseLocomotive.Size = new System.Drawing.Size(171, 23);
|
||||
this.buttonCreateBaseLocomotive.TabIndex = 2;
|
||||
this.buttonCreateBaseLocomotive.Text = "создать обычный поезд";
|
||||
this.buttonCreateBaseLocomotive.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateBaseLocomotive.Click += new System.EventHandler(this.ButtonCreateBaseLocomotive_Click);
|
||||
pictureBoxLocomotive.Dock = DockStyle.Fill;
|
||||
pictureBoxLocomotive.Location = new Point(0, 0);
|
||||
pictureBoxLocomotive.Name = "pictureBoxLocomotive";
|
||||
pictureBoxLocomotive.Size = new Size(880, 561);
|
||||
pictureBoxLocomotive.TabIndex = 1;
|
||||
pictureBoxLocomotive.TabStop = false;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonUp.Location = new System.Drawing.Point(691, 362);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonUp.TabIndex = 3;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUp.Location = new Point(771, 473);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(35, 35);
|
||||
buttonUp.TabIndex = 3;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonDown.Location = new System.Drawing.Point(691, 403);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonDown.TabIndex = 4;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDown.Location = new Point(771, 514);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(35, 35);
|
||||
buttonDown.TabIndex = 4;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(650, 403);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonLeft.TabIndex = 5;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonLeft.Location = new Point(730, 514);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(35, 35);
|
||||
buttonLeft.TabIndex = 5;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonRight.Location = new System.Drawing.Point(732, 403);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonRight.TabIndex = 6;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonCreateLocomotive
|
||||
//
|
||||
this.buttonCreateLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateLocomotive.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
|
||||
this.buttonCreateLocomotive.Location = new System.Drawing.Point(189, 415);
|
||||
this.buttonCreateLocomotive.Name = "buttonCreateLocomotive";
|
||||
this.buttonCreateLocomotive.Size = new System.Drawing.Size(173, 23);
|
||||
this.buttonCreateLocomotive.TabIndex = 7;
|
||||
this.buttonCreateLocomotive.Text = "создать продвинутый поезд";
|
||||
this.buttonCreateLocomotive.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateLocomotive.Click += new System.EventHandler(this.ButtonCreateLocomotive_Click);
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRight.Location = new Point(812, 514);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(35, 35);
|
||||
buttonRight.TabIndex = 6;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Items.AddRange(new object[] {
|
||||
"К центру",
|
||||
"К краю"});
|
||||
this.comboBox1.Location = new System.Drawing.Point(667, 12);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(121, 23);
|
||||
this.comboBox1.TabIndex = 8;
|
||||
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBox1.FormattingEnabled = true;
|
||||
comboBox1.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||
comboBox1.Location = new Point(667, 12);
|
||||
comboBox1.Name = "comboBox1";
|
||||
comboBox1.Size = new Size(121, 23);
|
||||
comboBox1.TabIndex = 8;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
this.buttonStrategyStep.Location = new System.Drawing.Point(713, 41);
|
||||
this.buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
this.buttonStrategyStep.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonStrategyStep.TabIndex = 9;
|
||||
this.buttonStrategyStep.Text = "Шаг";
|
||||
this.buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
this.buttonStrategyStep.Click += new System.EventHandler(this.buttonStrategyStep_Click);
|
||||
buttonStrategyStep.Location = new Point(713, 41);
|
||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
buttonStrategyStep.Size = new Size(75, 23);
|
||||
buttonStrategyStep.TabIndex = 9;
|
||||
buttonStrategyStep.Text = "Шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += buttonStrategyStep_Click;
|
||||
//
|
||||
// LocomotiveProject
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.buttonStrategyStep);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.buttonCreateLocomotive);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.buttonCreateBaseLocomotive);
|
||||
this.Controls.Add(this.pictureBoxLocomotive);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Name = "LocomotiveProject";
|
||||
this.Text = "Тепловоз";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(880, 561);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBox1);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(pictureBoxLocomotive);
|
||||
Controls.Add(pictureBox1);
|
||||
Name = "LocomotiveProject";
|
||||
Text = "Тепловоз";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBox1;
|
||||
private PictureBox pictureBoxLocomotive;
|
||||
private Button buttonCreateBaseLocomotive;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonLeft;
|
||||
private Button buttonRight;
|
||||
private Button buttonCreateLocomotive;
|
||||
private ComboBox comboBox1;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using LocomotiveProject.Entities;
|
||||
using LocomativeProject.Drawnings;
|
||||
using LocomotiveProject.Drawnings;
|
||||
using LocomativeProject.Drawnings;
|
||||
using LocomativeProject.MovementStrategy;
|
||||
|
||||
namespace LocomativeProject
|
||||
namespace LocomotiveProject
|
||||
{
|
||||
public partial class LocomotiveProject : Form
|
||||
{
|
||||
@ -21,6 +21,18 @@ namespace LocomativeProject
|
||||
|
||||
private AbstractStrategy? _strategy;
|
||||
|
||||
public DrawningBaseLocomotive SetLocomotive
|
||||
{
|
||||
set
|
||||
{
|
||||
_drawningLocomotive = value;
|
||||
_drawningLocomotive.SetPictureSize(pictureBox1.Width, pictureBox1.Height);
|
||||
comboBox1.Enabled = true;
|
||||
_strategy = null;
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
public LocomotiveProject()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net7.0-windows7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?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">
|
||||
|
169
LocomativeProject/LocomativeProject/LocomotiveProjectCollection.Designer.cs
generated
Normal file
169
LocomativeProject/LocomativeProject/LocomotiveProjectCollection.Designer.cs
generated
Normal file
@ -0,0 +1,169 @@
|
||||
namespace LocomotiveProject
|
||||
{
|
||||
partial class LocomotiveProjectCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
groupBox1 = new GroupBox();
|
||||
buttonRefresh = new Button();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonRemoveLocomotive = new Button();
|
||||
maskedTextBox = new MaskedTextBox();
|
||||
buttonModifLocomotive = new Button();
|
||||
buttonAddLocomotive = new Button();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
groupBox1.Controls.Add(buttonRefresh);
|
||||
groupBox1.Controls.Add(buttonGoToCheck);
|
||||
groupBox1.Controls.Add(buttonRemoveLocomotive);
|
||||
groupBox1.Controls.Add(maskedTextBox);
|
||||
groupBox1.Controls.Add(buttonModifLocomotive);
|
||||
groupBox1.Controls.Add(buttonAddLocomotive);
|
||||
groupBox1.Controls.Add(comboBoxSelectorCompany);
|
||||
groupBox1.Dock = DockStyle.Right;
|
||||
groupBox1.Location = new Point(912, 0);
|
||||
groupBox1.Name = "groupBox1";
|
||||
groupBox1.Size = new Size(180, 581);
|
||||
groupBox1.TabIndex = 0;
|
||||
groupBox1.TabStop = false;
|
||||
groupBox1.Text = "Инструменты";
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Location = new Point(32, 530);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(124, 39);
|
||||
buttonRefresh.TabIndex = 6;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Location = new Point(32, 349);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(124, 39);
|
||||
buttonGoToCheck.TabIndex = 5;
|
||||
buttonGoToCheck.Text = "Передать на тесты";
|
||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||
//
|
||||
// buttonRemoveLocomotive
|
||||
//
|
||||
buttonRemoveLocomotive.Location = new Point(18, 207);
|
||||
buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
|
||||
buttonRemoveLocomotive.Size = new Size(150, 23);
|
||||
buttonRemoveLocomotive.TabIndex = 4;
|
||||
buttonRemoveLocomotive.Text = "Удалить поезд";
|
||||
buttonRemoveLocomotive.UseVisualStyleBackColor = true;
|
||||
buttonRemoveLocomotive.Click += ButtonRemoveLocomotive_Click;
|
||||
//
|
||||
// maskedTextBox
|
||||
//
|
||||
maskedTextBox.Location = new Point(18, 178);
|
||||
maskedTextBox.Mask = "00";
|
||||
maskedTextBox.Name = "maskedTextBox";
|
||||
maskedTextBox.Size = new Size(150, 23);
|
||||
maskedTextBox.TabIndex = 3;
|
||||
maskedTextBox.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonModifLocomotive
|
||||
//
|
||||
buttonModifLocomotive.Location = new Point(18, 102);
|
||||
buttonModifLocomotive.Name = "buttonModifLocomotive";
|
||||
buttonModifLocomotive.Size = new Size(150, 43);
|
||||
buttonModifLocomotive.TabIndex = 2;
|
||||
buttonModifLocomotive.Text = "Добавление модиф поезда";
|
||||
buttonModifLocomotive.UseVisualStyleBackColor = true;
|
||||
buttonModifLocomotive.Click += ButtonModifLocomotive_Click;
|
||||
//
|
||||
// buttonAddLocomotive
|
||||
//
|
||||
buttonAddLocomotive.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddLocomotive.Location = new Point(18, 62);
|
||||
buttonAddLocomotive.Name = "buttonAddLocomotive";
|
||||
buttonAddLocomotive.Size = new Size(150, 23);
|
||||
buttonAddLocomotive.TabIndex = 1;
|
||||
buttonAddLocomotive.Text = "Добавление поезда";
|
||||
buttonAddLocomotive.UseVisualStyleBackColor = true;
|
||||
buttonAddLocomotive.Click += ButtonAddLocomotive_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(18, 22);
|
||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||
comboBoxSelectorCompany.Size = new Size(150, 23);
|
||||
comboBoxSelectorCompany.TabIndex = 0;
|
||||
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
pictureBox.Dock = DockStyle.Fill;
|
||||
pictureBox.Location = new Point(0, 0);
|
||||
pictureBox.Name = "pictureBox";
|
||||
pictureBox.Size = new Size(912, 581);
|
||||
pictureBox.TabIndex = 1;
|
||||
pictureBox.TabStop = false;
|
||||
//
|
||||
// LocomotiveProjectCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1092, 581);
|
||||
Controls.Add(pictureBox);
|
||||
Controls.Add(groupBox1);
|
||||
Name = "LocomotiveProjectCollection";
|
||||
Text = "Коллекция Тепловозов";
|
||||
groupBox1.ResumeLayout(false);
|
||||
groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBox1;
|
||||
private ComboBox comboBoxSelectorCompany;
|
||||
private Button buttonAddLocomotive;
|
||||
private Button buttonModifLocomotive;
|
||||
private Button buttonRemoveLocomotive;
|
||||
private MaskedTextBox maskedTextBox;
|
||||
private PictureBox pictureBox;
|
||||
private Button buttonRefresh;
|
||||
private Button buttonGoToCheck;
|
||||
}
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
using LocomativeProject.Drawnings;
|
||||
using LocomotiveProject.CollectionGenericObjects;
|
||||
using LocomotiveProject.Drawnings;
|
||||
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 LocomotiveProject;
|
||||
public partial class LocomotiveProjectCollection : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Компания
|
||||
/// </summary>
|
||||
private AbstractCompany? _company = null;
|
||||
/// <summary>
|
||||
/// Консруктор
|
||||
/// </summary>
|
||||
public LocomotiveProjectCollection()
|
||||
{
|
||||
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 LocomotiveDock(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningBaseLocomotive>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Создание объекта класса-перемещения
|
||||
/// </summary>
|
||||
/// <param name="type"> тип создаваемого объекта</param>
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Random rnd = new();
|
||||
DrawningBaseLocomotive drawningBaseLocomotive;
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningBaseLocomotive):
|
||||
drawningBaseLocomotive = new DrawningBaseLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd));
|
||||
break;
|
||||
case nameof(DrawningLocomotive):
|
||||
drawningBaseLocomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd), GetColor(rnd),
|
||||
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (_company + drawningBaseLocomotive != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _company.Show();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение рандом цвета
|
||||
/// </summary>
|
||||
/// <param name="rnd"></param>
|
||||
/// <returns></returns>
|
||||
private static Color GetColor(Random rnd)
|
||||
{
|
||||
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(255, 256));
|
||||
ColorDialog dialog = new ColorDialog();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
/// <summary>
|
||||
/// Кнопка создания обычного поезда
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBaseLocomotive));
|
||||
/// <summary>
|
||||
/// Кнопка создания модиф поезда
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonModifLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLocomotive));
|
||||
/// <summary>
|
||||
/// Кнопка удаления поезда
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(maskedTextBox.Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBox.Text);
|
||||
if (_company - pos != 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;
|
||||
}
|
||||
DrawningBaseLocomotive BaseLocomotive = null;
|
||||
int counter = 100;
|
||||
while (BaseLocomotive == null)
|
||||
{
|
||||
BaseLocomotive = _company.GetRandomObject();
|
||||
counter--;
|
||||
if (counter <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (BaseLocomotive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LocomotiveProject form = new() { SetLocomotive = BaseLocomotive };
|
||||
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();
|
||||
}
|
||||
}
|
@ -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>
|
@ -1,4 +1,4 @@
|
||||
namespace LocomativeProject
|
||||
namespace LocomotiveProject
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
@ -11,7 +11,7 @@ namespace LocomativeProject
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new LocomotiveProject());
|
||||
Application.Run(new LocomotiveProjectCollection());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LocomativeProject.Properties {
|
||||
namespace LocomotiveProject.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ namespace LocomativeProject.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocomativeProject.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocomotiveProject.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
|
2
desktop.ini
Normal file
2
desktop.ini
Normal file
@ -0,0 +1,2 @@
|
||||
[.ShellClassInfo]
|
||||
LocalizedResourceName=ÎÎÏ Êèðèëèí ÏÈáä11(final version)
|
Loading…
Reference in New Issue
Block a user