diff --git a/ProjectRoadTrain/ProjectRoadTrain/CollectionGenericObjects/AbstractCompany.cs b/ProjectRoadTrain/ProjectRoadTrain/CollectionGenericObjects/AbstractCompany.cs
new file mode 100644
index 0000000..4e7ebf4
--- /dev/null
+++ b/ProjectRoadTrain/ProjectRoadTrain/CollectionGenericObjects/AbstractCompany.cs
@@ -0,0 +1,114 @@
+using ProjectRoadTrain.Drawnings;
+
+namespace ProjectRoadTrain.CollectionGenericObjects;
+
+///
+/// Абстракция компании, хранящий коллекцию поездов
+///
+public abstract class AbstractCompany
+{
+ ///
+ /// Размер места (ширина)
+ ///
+ protected readonly int _placeSizeWidth = 200;
+
+ ///
+ /// Размер места (высота)
+ ///
+ protected readonly int _placeSizeHeight = 110;
+
+ ///
+ /// Ширина окна
+ ///
+ protected readonly int _pictureWidth;
+
+ ///
+ /// Высота окна
+ ///
+ protected readonly int _pictureHeight;
+
+ ///
+ /// Коллекция поездов
+ ///
+ protected ICollectionGenericObjects? _collection = null;
+
+ ///
+ /// Вычисление максимального количества элементов, который можно разместить в окне
+ ///
+ private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
+
+ ///
+ /// Конструктор
+ ///
+ /// Ширина окна
+ /// Высота окна
+ /// Коллекция автомобилей
+ public AbstractCompany(int picWidth, int picHeight,
+ ICollectionGenericObjects collection)
+ {
+ _pictureWidth = picWidth;
+ _pictureHeight = picHeight;
+ _collection = collection;
+ _collection.SetMaxCount = GetMaxCount;
+ }
+
+ ///
+ /// Перегрузка оператора сложения для класса
+ ///
+ /// Компания
+ /// Добавляемый объект
+ ///
+ public static int operator +(AbstractCompany company, DrawningTrain aircraft)
+ {
+ return company._collection.Insert(aircraft);
+ }
+
+ ///
+ /// Перегрузка оператора удаления для класса
+ ///
+ /// Компания
+ /// Номер удаляемого объекта
+ ///
+ public static DrawningTrain operator -(AbstractCompany company, int position)
+ {
+ return company._collection?.Remove(position);
+ }
+
+ ///
+ /// Получение случайного объекта из коллекции
+ ///
+ ///
+ public DrawningTrain? GetRandomObject()
+ {
+ Random rnd = new();
+ return _collection?.Get(rnd.Next(GetMaxCount));
+ }
+
+ ///
+ /// Вывод всей коллекции
+ ///
+ ///
+ public Bitmap? Show()
+ {
+ Bitmap bitmap = new(_pictureWidth, _pictureHeight);
+ Graphics graphics = Graphics.FromImage(bitmap);
+ DrawBackgound(graphics);
+ SetObjectsPosition();
+ for (int i = 0; i < (_collection?.Count ?? 0); ++i)
+ {
+ DrawningTrain? obj = _collection?.Get(i);
+ obj?.DrawTransport(graphics);
+ }
+ return bitmap;
+ }
+ ///
+ /// Вывод заднего фона
+ ///
+ ///
+ protected abstract void DrawBackgound(Graphics g);
+
+ ///
+ /// Расстановка объектов
+ ///
+ protected abstract void SetObjectsPosition();
+}
diff --git a/ProjectRoadTrain/ProjectRoadTrain/CollectionGenericObjects/TrainSharingService.cs b/ProjectRoadTrain/ProjectRoadTrain/CollectionGenericObjects/TrainSharingService.cs
new file mode 100644
index 0000000..6cd1fa7
--- /dev/null
+++ b/ProjectRoadTrain/ProjectRoadTrain/CollectionGenericObjects/TrainSharingService.cs
@@ -0,0 +1,66 @@
+using ProjectRoadTrain.Drawnings;
+
+namespace ProjectRoadTrain.CollectionGenericObjects;
+
+
+ ///
+ /// Реализация абстрактной компании - каршеринг
+ ///
+ public class TrainSharingService : AbstractCompany
+{
+ ///
+ /// Конструктор
+ ///
+ ///
+ ///
+ ///
+ public TrainSharingService(int picWidth, int picHeight,
+ ICollectionGenericObjects collection) : base(picWidth, picHeight, collection)
+ {
+ }
+ protected override void DrawBackgound(Graphics g)
+ {
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+ Pen pen = new(Color.Black, 2);
+ for (int i = 0; i < width + 1; i++)
+ {
+ for (int j = 0; j < height + 1; ++j)
+ {
+ g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth - _placeSizeWidth + 8, j * _placeSizeHeight);
+ g.DrawLine(pen, i * _placeSizeWidth - _placeSizeWidth + 8, j * _placeSizeHeight, i * _placeSizeWidth - _placeSizeWidth + 8, j * _placeSizeHeight - _placeSizeHeight);
+ }
+ }
+ }
+ protected override void SetObjectsPosition()
+ {
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+
+ int curWidth = width - 1;
+ int curHeight = 0;
+
+ for (int i = 0; i < (_collection?.Count ?? 0); i++)
+ {
+ if (_collection.Get(i) != null)
+ {
+ _collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 10, curHeight * _placeSizeHeight + 10);
+ }
+
+ if (curWidth > 0)
+ curWidth--;
+ else
+ {
+ curWidth = width - 1;
+ curHeight++;
+ }
+
+ if (curHeight >= height)
+ {
+ return;
+ }
+ }
+ }
+}
+
diff --git a/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.Designer.cs b/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.Designer.cs
index 18e9d80..44356e6 100644
--- a/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.Designer.cs
+++ b/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.Designer.cs
@@ -45,14 +45,14 @@
pictureBoxRoadTrain.Dock = DockStyle.Fill;
pictureBoxRoadTrain.Location = new Point(0, 0);
pictureBoxRoadTrain.Name = "pictureBoxRoadTrain";
- pictureBoxRoadTrain.Size = new Size(800, 450);
+ pictureBoxRoadTrain.Size = new Size(886, 501);
pictureBoxRoadTrain.TabIndex = 0;
pictureBoxRoadTrain.TabStop = false;
//
// buttonCreateRoadTrain
//
buttonCreateRoadTrain.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
- buttonCreateRoadTrain.Location = new Point(12, 415);
+ buttonCreateRoadTrain.Location = new Point(12, 466);
buttonCreateRoadTrain.Name = "buttonCreateRoadTrain";
buttonCreateRoadTrain.Size = new Size(175, 23);
buttonCreateRoadTrain.TabIndex = 1;
@@ -65,7 +65,7 @@
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonDown.BackgroundImage = Properties.Resources.arrowDown;
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
- buttonDown.Location = new Point(666, 409);
+ buttonDown.Location = new Point(752, 460);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(35, 35);
buttonDown.TabIndex = 2;
@@ -77,7 +77,7 @@
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonUp.BackgroundImage = Properties.Resources.arrowUp;
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
- buttonUp.Location = new Point(666, 329);
+ buttonUp.Location = new Point(752, 380);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(35, 35);
buttonUp.TabIndex = 3;
@@ -89,7 +89,7 @@
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonLeft.BackgroundImage = Properties.Resources.arrowLeft;
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
- buttonLeft.Location = new Point(632, 370);
+ buttonLeft.Location = new Point(718, 421);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(35, 35);
buttonLeft.TabIndex = 4;
@@ -101,7 +101,7 @@
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
buttonRight.BackgroundImage = Properties.Resources.arrowRight;
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
- buttonRight.Location = new Point(699, 370);
+ buttonRight.Location = new Point(785, 421);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(35, 35);
buttonRight.TabIndex = 5;
@@ -111,7 +111,7 @@
// buttonCreateTrain
//
buttonCreateTrain.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
- buttonCreateTrain.Location = new Point(205, 415);
+ buttonCreateTrain.Location = new Point(205, 466);
buttonCreateTrain.Name = "buttonCreateTrain";
buttonCreateTrain.Size = new Size(175, 23);
buttonCreateTrain.TabIndex = 6;
@@ -125,7 +125,7 @@
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxStrategy.FormattingEnabled = true;
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
- comboBoxStrategy.Location = new Point(667, 12);
+ comboBoxStrategy.Location = new Point(753, 12);
comboBoxStrategy.Name = "comboBoxStrategy";
comboBoxStrategy.Size = new Size(121, 23);
comboBoxStrategy.TabIndex = 7;
@@ -133,7 +133,7 @@
// buttonStrategyStep
//
buttonStrategyStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
- buttonStrategyStep.Location = new Point(713, 41);
+ buttonStrategyStep.Location = new Point(799, 41);
buttonStrategyStep.Name = "buttonStrategyStep";
buttonStrategyStep.Size = new Size(75, 23);
buttonStrategyStep.TabIndex = 8;
@@ -145,7 +145,7 @@
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(800, 450);
+ ClientSize = new Size(886, 501);
Controls.Add(buttonStrategyStep);
Controls.Add(comboBoxStrategy);
Controls.Add(buttonCreateTrain);
diff --git a/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.cs b/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.cs
index 0f8d54c..190fbca 100644
--- a/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.cs
+++ b/ProjectRoadTrain/ProjectRoadTrain/FormRoadTrain.cs
@@ -1,15 +1,14 @@
-//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 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 ProjectRoadTrain.Drawnings;
using ProjectRoadTrain.MovementStrategy;
-//using ProjectRoadTrain.MovementStrategy;
namespace ProjectRoadTrain;
///
@@ -27,6 +26,8 @@ public partial class FormRoadTrain : Form
///
private AbstractStrategy? _strategy;
+ public DrawningTrain SetTrain { get; internal set; }
+
///
/// Конструктор формы
diff --git a/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.Designer.cs b/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.Designer.cs
new file mode 100644
index 0000000..ba92b5d
--- /dev/null
+++ b/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.Designer.cs
@@ -0,0 +1,178 @@
+namespace ProjectRoadTrain
+{
+ partial class FormTrainCollection
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ groupBoxTools = new GroupBox();
+ maskedTextBox = new MaskedTextBox();
+ buttonRefresh = new Button();
+ buttonGoToCheck = new Button();
+ buttonRemoveTrain = new Button();
+ buttonAddRoadTrain = new Button();
+ buttonAddTrain = new Button();
+ comboBoxSelectorCompany = new ComboBox();
+ pictureBox = new PictureBox();
+ groupBoxTools.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
+ SuspendLayout();
+ //
+ // groupBoxTools
+ //
+ groupBoxTools.Controls.Add(maskedTextBox);
+ groupBoxTools.Controls.Add(buttonRefresh);
+ groupBoxTools.Controls.Add(buttonGoToCheck);
+ groupBoxTools.Controls.Add(buttonRemoveTrain);
+ groupBoxTools.Controls.Add(buttonAddRoadTrain);
+ groupBoxTools.Controls.Add(buttonAddTrain);
+ groupBoxTools.Controls.Add(comboBoxSelectorCompany);
+ groupBoxTools.Dock = DockStyle.Right;
+ groupBoxTools.Location = new Point(753, 0);
+ groupBoxTools.Name = "groupBoxTools";
+ groupBoxTools.Size = new Size(269, 589);
+ groupBoxTools.TabIndex = 0;
+ groupBoxTools.TabStop = false;
+ groupBoxTools.Text = "Инструменты";
+ //
+ // maskedTextBox
+ //
+ maskedTextBox.Location = new Point(19, 260);
+ maskedTextBox.Mask = "00";
+ maskedTextBox.Name = "maskedTextBox";
+ maskedTextBox.Size = new Size(228, 23);
+ maskedTextBox.TabIndex = 6;
+ maskedTextBox.ValidatingType = typeof(int);
+ //
+ // buttonRefresh
+ //
+ buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonRefresh.Location = new Point(20, 483);
+ buttonRefresh.Name = "buttonRefresh";
+ buttonRefresh.Size = new Size(229, 59);
+ buttonRefresh.TabIndex = 5;
+ buttonRefresh.Text = "Обновить";
+ buttonRefresh.UseVisualStyleBackColor = true;
+ buttonRefresh.Click += ButtonRefresh_Click;
+
+ //
+ // buttonGoToCheck
+ //
+ buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonGoToCheck.Location = new Point(18, 389);
+ buttonGoToCheck.Name = "buttonGoToCheck";
+ buttonGoToCheck.Size = new Size(229, 59);
+ buttonGoToCheck.TabIndex = 4;
+ buttonGoToCheck.Text = "Передать на тесты";
+ buttonGoToCheck.UseVisualStyleBackColor = true;
+ buttonGoToCheck.Click += ButtonGoToCheck_Click;
+
+ //
+ // buttonRemoveTrain
+ //
+ buttonRemoveTrain.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonRemoveTrain.Location = new Point(20, 289);
+ buttonRemoveTrain.Name = "buttonRemoveTrain";
+ buttonRemoveTrain.Size = new Size(229, 59);
+ buttonRemoveTrain.TabIndex = 3;
+ buttonRemoveTrain.Text = "Удалить поезд";
+ buttonRemoveTrain.UseVisualStyleBackColor = true;
+ buttonRemoveTrain.Click += ButtonRemoveTrain_Click;
+
+ //
+ // buttonAddRoadTrain
+ //
+ buttonAddRoadTrain.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddRoadTrain.Location = new Point(19, 152);
+ buttonAddRoadTrain.Name = "buttonAddRoadTrain";
+ buttonAddRoadTrain.Size = new Size(229, 59);
+ buttonAddRoadTrain.TabIndex = 2;
+ buttonAddRoadTrain.Text = "Добавить автопоезд";
+ buttonAddRoadTrain.UseVisualStyleBackColor = true;
+ buttonAddRoadTrain.Click += ButtonAddRoadTrain_Click;
+
+ //
+ // buttonAddTrain
+ //
+ buttonAddTrain.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddTrain.Location = new Point(19, 87);
+ buttonAddTrain.Name = "buttonAddTrain";
+ buttonAddTrain.Size = new Size(229, 59);
+ buttonAddTrain.TabIndex = 1;
+ buttonAddTrain.Text = "Добавить поезда";
+ buttonAddTrain.UseVisualStyleBackColor = true;
+ buttonAddTrain.Click += ButtonAddTrain_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(19, 22);
+ comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
+ comboBoxSelectorCompany.Size = new Size(229, 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(753, 589);
+ pictureBox.TabIndex = 1;
+ pictureBox.TabStop = false;
+ //
+ // FormTrainCollection
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1022, 589);
+ Controls.Add(pictureBox);
+ Controls.Add(groupBoxTools);
+ Name = "FormTrainCollection";
+ Text = "Коллекция поездов";
+ groupBoxTools.ResumeLayout(false);
+ groupBoxTools.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBoxTools;
+ private ComboBox comboBoxSelectorCompany;
+ private Button buttonAddTrain;
+ private Button buttonAddRoadTrain;
+ private MaskedTextBox maskedTextBox;
+ private Button buttonRefresh;
+ private Button buttonGoToCheck;
+ private Button buttonRemoveTrain;
+ private PictureBox pictureBox;
+ }
+}
\ No newline at end of file
diff --git a/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.cs b/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.cs
new file mode 100644
index 0000000..807d219
--- /dev/null
+++ b/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.cs
@@ -0,0 +1,165 @@
+using ProjectRoadTrain.CollectionGenericObjects;
+using ProjectRoadTrain.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 ProjectRoadTrain
+{
+ public partial class FormTrainCollection : Form
+ {
+ ///
+ /// Компания
+ ///
+ private AbstractCompany? _company = null;
+ ///
+ /// Конструктор
+ ///
+ public FormTrainCollection()
+ {
+ InitializeComponent();
+ }
+
+ private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ switch (comboBoxSelectorCompany.Text)
+ {
+ case "Хранилище":
+ _company = new TrainSharingService(pictureBox.Width,
+ pictureBox.Height, new MassiveGenericObjects());
+ break;
+ }
+ }
+
+ ///
+ /// Создание объекта класса-перемещения
+ ///
+ /// Тип создаваемого объекта
+ private void CreateObject(string type)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ Random random = new();
+ DrawningTrain drawningTrain;
+ switch (type)
+ {
+ case nameof(DrawningTrain):
+ drawningTrain = new DrawningTrain(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
+ break;
+ case nameof(DrawningRoadTrain):
+ drawningTrain = 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 + drawningTrain != -1)
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBox.Image = _company.Show();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
+ }
+
+ ///
+ /// Получение цвета
+ ///
+ /// Генератор случайных чисел
+ ///
+ private static Color GetColor(Random random)
+ {
+ Color color = Color.FromArgb(random.Next(0, 256), random.Next(0,
+ 256), random.Next(0, 256));
+ ColorDialog dialog = new();
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ color = dialog.Color;
+ }
+ return color;
+ }
+ //private void ButtonAddTrain_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrain));
+ //private void ButtonRoadTrain_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningRoadTrain));
+ private void ButtonAddTrain_Click(object sender, EventArgs e)
+ {
+ CreateObject(nameof(DrawningTrain));
+ }
+
+ private void ButtonAddRoadTrain_Click(object sender, EventArgs e)
+ {
+ CreateObject(nameof(DrawningRoadTrain));
+ }
+
+ private void ButtonRemoveTrain_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(maskedTextBox.Text) || _company == null)
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить объект?", "Удаление",
+ MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
+ {
+ return;
+ }
+ int pos = Convert.ToInt32(maskedTextBox.Text);
+ if (_company - pos != null)
+ {
+ MessageBox.Show("Объект удален!");
+ pictureBox.Image = _company.Show();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось удалить объект");
+ }
+ }
+
+ private void ButtonGoToCheck_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+
+ DrawningTrain? train = null;
+ int counter = 100;
+ while (train == null)
+ {
+ train = _company.GetRandomObject();
+ counter--;
+ if (counter <= 0)
+ {
+ break;
+ }
+ }
+ if (train == null)
+ {
+ return;
+ }
+ FormRoadTrain form = new()
+ {
+ SetTrain = train
+ };
+ form.ShowDialog();
+ }
+
+ private void ButtonRefresh_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+
+ pictureBox.Image = _company.Show();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.resx b/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ProjectRoadTrain/ProjectRoadTrain/FormTrainCollection.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectRoadTrain/ProjectRoadTrain/Program.cs b/ProjectRoadTrain/ProjectRoadTrain/Program.cs
index d87a77e..2ccde8f 100644
--- a/ProjectRoadTrain/ProjectRoadTrain/Program.cs
+++ b/ProjectRoadTrain/ProjectRoadTrain/Program.cs
@@ -11,7 +11,7 @@ namespace ProjectRoadTrain
// 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 FormTrainCollection());
}
}
}
\ No newline at end of file