Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d18cbcd248 | |||
| 9186126412 | |||
| 8ed442d581 | |||
| 76b7233095 | |||
| 224eaff7b8 | |||
| 6fdbfe8a89 | |||
| 9c700db2f0 | |||
| 722d1769ac | |||
| cd3c8b9b6d | |||
| 2bac38aea2 | |||
| aa8035f87e | |||
| 262b7106d1 | |||
| dba9d94527 | |||
| 08af1d11ad | |||
| a03fc8bb8a | |||
| 2b0d5459ce | |||
| d26f6f304a | |||
| 209b4fe7c7 | |||
| 38040108d6 | |||
| 38ed0c2a42 | |||
| 55e54327c6 | |||
| 9e6f53cfcc |
@@ -186,7 +186,6 @@
|
|||||||
int x = _random.Next(10, 100);
|
int x = _random.Next(10, 100);
|
||||||
int y = _random.Next(10, 100);
|
int y = _random.Next(10, 100);
|
||||||
_drawningObject.SetObject(x, y, _width, _height);
|
_drawningObject.SetObject(x, y, _width, _height);
|
||||||
// TODO првоерка, что объект не "накладывается" на закрытые участки
|
|
||||||
if (!AbleToSetObject())
|
if (!AbleToSetObject())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перечисление направлений перемещения
|
/// Перечисление направлений перемещения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal enum Direction
|
public enum Direction
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// никуда
|
/// никуда
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс, отвечающий за отрисовку объекта-сущности
|
/// Класс, отвечающий за отрисовку объекта-сущности
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class DrawningLocomotive
|
public class DrawningLocomotive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Класс-сущность
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
{
|
{
|
||||||
_locomotive.DrawTransport(g);
|
_locomotive.DrawTransport(g);
|
||||||
}
|
}
|
||||||
|
public string GetInfo() => _locomotive?.GetDataForSave();
|
||||||
|
public static IDrawningObject Create(string data) => new DrawningObjectLocomotive(data.CreateDrawningLocomotive());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность локомотив
|
/// Класс-сущность локомотив
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class EntityLocomotive
|
public class EntityLocomotive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Скорость
|
/// Скорость
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Цвет кузова
|
/// Цвет кузова
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Шаг перемещения
|
/// Шаг перемещения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет
|
/// Дополнительный цвет
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак наличия трубы
|
/// Признак наличия трубы
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
50
Locomotives/Locomotives/ExtentionLocomotive.cs
Normal file
50
Locomotives/Locomotives/ExtentionLocomotive.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Расширение для класса DrawningLocomotive
|
||||||
|
/// </summary>
|
||||||
|
internal static class ExtentionLocomotive
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи информации
|
||||||
|
/// </summary>
|
||||||
|
private static readonly char _separatorForObject = ':';
|
||||||
|
/// <summary>
|
||||||
|
/// Получаем данные для сохранения в файл
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="drawningLocomotive"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetDataForSave(this DrawningLocomotive drawningLocomotive)
|
||||||
|
{
|
||||||
|
var locomotive = drawningLocomotive.Locomotive;
|
||||||
|
var str = $"{locomotive.Speed}{_separatorForObject}{locomotive.Weight}{_separatorForObject}{locomotive.BodyColor.Name}";
|
||||||
|
if (locomotive is not EntityWarmlyLocomotive warmlyLocomotive)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return $"{str}{_separatorForObject}{warmlyLocomotive.AdditionalColor.Name}{_separatorForObject}{warmlyLocomotive.HasPipe}{_separatorForObject}{warmlyLocomotive.HasFuelTank}";
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Восстанавливаем объект по полученной из файла информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DrawningLocomotive CreateDrawningLocomotive(this string info)
|
||||||
|
{
|
||||||
|
string[] strs = info.Split(_separatorForObject);
|
||||||
|
if (strs.Length == 3)
|
||||||
|
{
|
||||||
|
return new DrawningLocomotive(Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]));
|
||||||
|
}
|
||||||
|
if (strs.Length == 6)
|
||||||
|
{
|
||||||
|
return new DrawningWarmlyLocomotive
|
||||||
|
(
|
||||||
|
Convert.ToInt32(strs[0]), Convert.ToInt32(strs[1]), Color.FromName(strs[2]), 160, 85,
|
||||||
|
Color.FromName(strs[3]), Convert.ToBoolean(strs[4]), Convert.ToBoolean(strs[5])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Locomotives/Locomotives/FormLocomotive.Designer.cs
generated
14
Locomotives/Locomotives/FormLocomotive.Designer.cs
generated
@@ -42,6 +42,7 @@
|
|||||||
this.buttonDown = new System.Windows.Forms.Button();
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
this.buttonUp = new System.Windows.Forms.Button();
|
||||||
this.buttonCreateModif = new System.Windows.Forms.Button();
|
this.buttonCreateModif = new System.Windows.Forms.Button();
|
||||||
|
this.buttonSelectLocomotive = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
|
||||||
this.statusStrip.SuspendLayout();
|
this.statusStrip.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@@ -179,11 +180,23 @@
|
|||||||
this.buttonCreateModif.UseVisualStyleBackColor = true;
|
this.buttonCreateModif.UseVisualStyleBackColor = true;
|
||||||
this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
||||||
//
|
//
|
||||||
|
// buttonSelectLocomotive
|
||||||
|
//
|
||||||
|
this.buttonSelectLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonSelectLocomotive.Location = new System.Drawing.Point(602, 395);
|
||||||
|
this.buttonSelectLocomotive.Name = "buttonSelectLocomotive";
|
||||||
|
this.buttonSelectLocomotive.Size = new System.Drawing.Size(78, 30);
|
||||||
|
this.buttonSelectLocomotive.TabIndex = 9;
|
||||||
|
this.buttonSelectLocomotive.Text = "Выбрать";
|
||||||
|
this.buttonSelectLocomotive.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonSelectLocomotive.Click += new System.EventHandler(this.ButtonSelectLocomotive_Click);
|
||||||
|
//
|
||||||
// FormLocomotive
|
// FormLocomotive
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.buttonSelectLocomotive);
|
||||||
this.Controls.Add(this.buttonCreateModif);
|
this.Controls.Add(this.buttonCreateModif);
|
||||||
this.Controls.Add(this.buttonUp);
|
this.Controls.Add(this.buttonUp);
|
||||||
this.Controls.Add(this.buttonDown);
|
this.Controls.Add(this.buttonDown);
|
||||||
@@ -218,5 +231,6 @@
|
|||||||
private ToolStripStatusLabel toolStripStatusLabelHasPipe;
|
private ToolStripStatusLabel toolStripStatusLabelHasPipe;
|
||||||
private ToolStripStatusLabel toolStripStatusLabelHasFuelTank;
|
private ToolStripStatusLabel toolStripStatusLabelHasFuelTank;
|
||||||
private Button buttonCreateModif;
|
private Button buttonCreateModif;
|
||||||
|
private Button buttonSelectLocomotive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,10 @@
|
|||||||
/// Объект от класса отрисовки локомотива
|
/// Объект от класса отрисовки локомотива
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private DrawningLocomotive _locomotive;
|
private DrawningLocomotive _locomotive;
|
||||||
|
/// <summary>
|
||||||
|
/// Выбранный объект
|
||||||
|
/// </summary>
|
||||||
|
public DrawningLocomotive SelectedLocomotive { get; private set; }
|
||||||
|
|
||||||
public FormLocomotive()
|
public FormLocomotive()
|
||||||
{
|
{
|
||||||
@@ -57,7 +61,13 @@
|
|||||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
_locomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
color = dialog.Color;
|
||||||
|
}
|
||||||
|
_locomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000), color);
|
||||||
SetData(_locomotive);
|
SetData(_locomotive);
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
@@ -105,15 +115,33 @@
|
|||||||
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
|
Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
color = dialog.Color;
|
||||||
|
}
|
||||||
|
Color additionalColor = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256));
|
||||||
|
ColorDialog dialogDop = new();
|
||||||
|
if (dialogDop.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
additionalColor = dialogDop.Color;
|
||||||
|
}
|
||||||
_locomotive = new DrawningWarmlyLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
_locomotive = new DrawningWarmlyLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
|
color,
|
||||||
160, 85,
|
160, 85,
|
||||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
|
additionalColor,
|
||||||
Convert.ToBoolean(rnd.Next(0, 2)),
|
Convert.ToBoolean(rnd.Next(0, 2)),
|
||||||
Convert.ToBoolean(rnd.Next(0, 2)));
|
Convert.ToBoolean(rnd.Next(0, 2)));
|
||||||
SetData(_locomotive);
|
SetData(_locomotive);
|
||||||
SetAdditionalData((DrawningWarmlyLocomotive)_locomotive);
|
SetAdditionalData((DrawningWarmlyLocomotive)_locomotive);
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonSelectLocomotive_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectedLocomotive = _locomotive;
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
389
Locomotives/Locomotives/FormLocomotiveConfig.Designer.cs
generated
Normal file
389
Locomotives/Locomotives/FormLocomotiveConfig.Designer.cs
generated
Normal file
@@ -0,0 +1,389 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
partial class FormLocomotiveConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.groupBoxConfig = new System.Windows.Forms.GroupBox();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonOk = new System.Windows.Forms.Button();
|
||||||
|
this.panelObject = new System.Windows.Forms.Panel();
|
||||||
|
this.labelAdditionalColor = new System.Windows.Forms.Label();
|
||||||
|
this.labelColor = new System.Windows.Forms.Label();
|
||||||
|
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||||
|
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||||
|
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||||
|
this.panelBlack = new System.Windows.Forms.Panel();
|
||||||
|
this.panelAqua = new System.Windows.Forms.Panel();
|
||||||
|
this.panelRed = new System.Windows.Forms.Panel();
|
||||||
|
this.panelWhite = new System.Windows.Forms.Panel();
|
||||||
|
this.panelGreen = new System.Windows.Forms.Panel();
|
||||||
|
this.panelPink = new System.Windows.Forms.Panel();
|
||||||
|
this.panelYellow = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlue = new System.Windows.Forms.Panel();
|
||||||
|
this.checkBoxHasFuelTank = new System.Windows.Forms.CheckBox();
|
||||||
|
this.checkBoxHasPipe = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.labelWeight = new System.Windows.Forms.Label();
|
||||||
|
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.labelSpeed = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxConfig.SuspendLayout();
|
||||||
|
this.panelObject.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||||
|
this.groupBoxColors.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxConfig
|
||||||
|
//
|
||||||
|
this.groupBoxConfig.Controls.Add(this.buttonCancel);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.buttonOk);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.panelObject);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.labelModifiedObject);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.labelSimpleObject);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.groupBoxColors);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.checkBoxHasFuelTank);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.checkBoxHasPipe);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.numericUpDownWeight);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.labelWeight);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.labelSpeed);
|
||||||
|
this.groupBoxConfig.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.groupBoxConfig.Name = "groupBoxConfig";
|
||||||
|
this.groupBoxConfig.Size = new System.Drawing.Size(674, 231);
|
||||||
|
this.groupBoxConfig.TabIndex = 0;
|
||||||
|
this.groupBoxConfig.TabStop = false;
|
||||||
|
this.groupBoxConfig.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(544, 193);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(118, 32);
|
||||||
|
this.buttonCancel.TabIndex = 11;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonOk
|
||||||
|
//
|
||||||
|
this.buttonOk.Location = new System.Drawing.Point(404, 192);
|
||||||
|
this.buttonOk.Name = "buttonOk";
|
||||||
|
this.buttonOk.Size = new System.Drawing.Size(118, 32);
|
||||||
|
this.buttonOk.TabIndex = 10;
|
||||||
|
this.buttonOk.Text = "Добавить";
|
||||||
|
this.buttonOk.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||||
|
//
|
||||||
|
// panelObject
|
||||||
|
//
|
||||||
|
this.panelObject.AllowDrop = true;
|
||||||
|
this.panelObject.Controls.Add(this.labelAdditionalColor);
|
||||||
|
this.panelObject.Controls.Add(this.labelColor);
|
||||||
|
this.panelObject.Controls.Add(this.pictureBoxObject);
|
||||||
|
this.panelObject.Location = new System.Drawing.Point(404, 22);
|
||||||
|
this.panelObject.Name = "panelObject";
|
||||||
|
this.panelObject.Size = new System.Drawing.Size(261, 164);
|
||||||
|
this.panelObject.TabIndex = 9;
|
||||||
|
this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
//
|
||||||
|
// labelAdditionalColor
|
||||||
|
//
|
||||||
|
this.labelAdditionalColor.AllowDrop = true;
|
||||||
|
this.labelAdditionalColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelAdditionalColor.Location = new System.Drawing.Point(138, 8);
|
||||||
|
this.labelAdditionalColor.Name = "labelAdditionalColor";
|
||||||
|
this.labelAdditionalColor.Size = new System.Drawing.Size(120, 45);
|
||||||
|
this.labelAdditionalColor.TabIndex = 11;
|
||||||
|
this.labelAdditionalColor.Text = "Доп. цвет";
|
||||||
|
this.labelAdditionalColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelAdditionalColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelAdditionalColor_DragDrop);
|
||||||
|
this.labelAdditionalColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
|
||||||
|
//
|
||||||
|
// labelColor
|
||||||
|
//
|
||||||
|
this.labelColor.AllowDrop = true;
|
||||||
|
this.labelColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelColor.Location = new System.Drawing.Point(3, 8);
|
||||||
|
this.labelColor.Name = "labelColor";
|
||||||
|
this.labelColor.Size = new System.Drawing.Size(115, 45);
|
||||||
|
this.labelColor.TabIndex = 10;
|
||||||
|
this.labelColor.Text = "Цвет";
|
||||||
|
this.labelColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
|
||||||
|
this.labelColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
|
||||||
|
//
|
||||||
|
// pictureBoxObject
|
||||||
|
//
|
||||||
|
this.pictureBoxObject.Location = new System.Drawing.Point(3, 56);
|
||||||
|
this.pictureBoxObject.Name = "pictureBoxObject";
|
||||||
|
this.pictureBoxObject.Size = new System.Drawing.Size(254, 105);
|
||||||
|
this.pictureBoxObject.TabIndex = 1;
|
||||||
|
this.pictureBoxObject.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelModifiedObject
|
||||||
|
//
|
||||||
|
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelModifiedObject.Location = new System.Drawing.Point(302, 141);
|
||||||
|
this.labelModifiedObject.Name = "labelModifiedObject";
|
||||||
|
this.labelModifiedObject.Size = new System.Drawing.Size(96, 45);
|
||||||
|
this.labelModifiedObject.TabIndex = 8;
|
||||||
|
this.labelModifiedObject.Text = "Продвинутый";
|
||||||
|
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// labelSimpleObject
|
||||||
|
//
|
||||||
|
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelSimpleObject.Location = new System.Drawing.Point(200, 141);
|
||||||
|
this.labelSimpleObject.Name = "labelSimpleObject";
|
||||||
|
this.labelSimpleObject.Size = new System.Drawing.Size(96, 45);
|
||||||
|
this.labelSimpleObject.TabIndex = 7;
|
||||||
|
this.labelSimpleObject.Text = "Простой";
|
||||||
|
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// groupBoxColors
|
||||||
|
//
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelBlack);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelAqua);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelRed);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelWhite);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelGreen);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelPink);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelYellow);
|
||||||
|
this.groupBoxColors.Controls.Add(this.panelBlue);
|
||||||
|
this.groupBoxColors.Location = new System.Drawing.Point(200, 22);
|
||||||
|
this.groupBoxColors.Name = "groupBoxColors";
|
||||||
|
this.groupBoxColors.Size = new System.Drawing.Size(198, 116);
|
||||||
|
this.groupBoxColors.TabIndex = 6;
|
||||||
|
this.groupBoxColors.TabStop = false;
|
||||||
|
this.groupBoxColors.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||||
|
this.panelBlack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelBlack.Location = new System.Drawing.Point(129, 63);
|
||||||
|
this.panelBlack.Name = "panelBlack";
|
||||||
|
this.panelBlack.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelBlack.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panelAqua
|
||||||
|
//
|
||||||
|
this.panelAqua.BackColor = System.Drawing.Color.Aqua;
|
||||||
|
this.panelAqua.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelAqua.Location = new System.Drawing.Point(88, 63);
|
||||||
|
this.panelAqua.Name = "panelAqua";
|
||||||
|
this.panelAqua.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelAqua.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panelRed
|
||||||
|
//
|
||||||
|
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||||
|
this.panelRed.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelRed.Location = new System.Drawing.Point(129, 22);
|
||||||
|
this.panelRed.Name = "panelRed";
|
||||||
|
this.panelRed.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelRed.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
this.panelWhite.BackColor = System.Drawing.Color.White;
|
||||||
|
this.panelWhite.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelWhite.Location = new System.Drawing.Point(47, 63);
|
||||||
|
this.panelWhite.Name = "panelWhite";
|
||||||
|
this.panelWhite.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelWhite.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelGreen
|
||||||
|
//
|
||||||
|
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
||||||
|
this.panelGreen.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelGreen.Location = new System.Drawing.Point(47, 22);
|
||||||
|
this.panelGreen.Name = "panelGreen";
|
||||||
|
this.panelGreen.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelGreen.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelPink
|
||||||
|
//
|
||||||
|
this.panelPink.BackColor = System.Drawing.Color.Pink;
|
||||||
|
this.panelPink.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelPink.Location = new System.Drawing.Point(88, 22);
|
||||||
|
this.panelPink.Name = "panelPink";
|
||||||
|
this.panelPink.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelPink.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelYellow
|
||||||
|
//
|
||||||
|
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||||
|
this.panelYellow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelYellow.Location = new System.Drawing.Point(6, 63);
|
||||||
|
this.panelYellow.Name = "panelYellow";
|
||||||
|
this.panelYellow.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelYellow.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||||
|
this.panelBlue.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.panelBlue.Location = new System.Drawing.Point(6, 22);
|
||||||
|
this.panelBlue.Name = "panelBlue";
|
||||||
|
this.panelBlue.Size = new System.Drawing.Size(35, 35);
|
||||||
|
this.panelBlue.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// checkBoxHasFuelTank
|
||||||
|
//
|
||||||
|
this.checkBoxHasFuelTank.AutoSize = true;
|
||||||
|
this.checkBoxHasFuelTank.Location = new System.Drawing.Point(23, 119);
|
||||||
|
this.checkBoxHasFuelTank.Name = "checkBoxHasFuelTank";
|
||||||
|
this.checkBoxHasFuelTank.Size = new System.Drawing.Size(171, 19);
|
||||||
|
this.checkBoxHasFuelTank.TabIndex = 5;
|
||||||
|
this.checkBoxHasFuelTank.Text = "Наличие топливного бака";
|
||||||
|
this.checkBoxHasFuelTank.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// checkBoxHasPipe
|
||||||
|
//
|
||||||
|
this.checkBoxHasPipe.AutoSize = true;
|
||||||
|
this.checkBoxHasPipe.Location = new System.Drawing.Point(23, 94);
|
||||||
|
this.checkBoxHasPipe.Name = "checkBoxHasPipe";
|
||||||
|
this.checkBoxHasPipe.Size = new System.Drawing.Size(112, 19);
|
||||||
|
this.checkBoxHasPipe.TabIndex = 4;
|
||||||
|
this.checkBoxHasPipe.Text = "Наличие трубы";
|
||||||
|
this.checkBoxHasPipe.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
this.numericUpDownWeight.Location = new System.Drawing.Point(88, 65);
|
||||||
|
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||||
|
2000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||||
|
this.numericUpDownWeight.Size = new System.Drawing.Size(56, 23);
|
||||||
|
this.numericUpDownWeight.TabIndex = 3;
|
||||||
|
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
this.labelWeight.AutoSize = true;
|
||||||
|
this.labelWeight.Location = new System.Drawing.Point(23, 67);
|
||||||
|
this.labelWeight.Name = "labelWeight";
|
||||||
|
this.labelWeight.Size = new System.Drawing.Size(26, 15);
|
||||||
|
this.labelWeight.TabIndex = 2;
|
||||||
|
this.labelWeight.Text = "Вес";
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
this.numericUpDownSpeed.Location = new System.Drawing.Point(88, 34);
|
||||||
|
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||||
|
200,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||||
|
this.numericUpDownSpeed.Size = new System.Drawing.Size(56, 23);
|
||||||
|
this.numericUpDownSpeed.TabIndex = 1;
|
||||||
|
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
this.labelSpeed.AutoSize = true;
|
||||||
|
this.labelSpeed.Location = new System.Drawing.Point(23, 36);
|
||||||
|
this.labelSpeed.Name = "labelSpeed";
|
||||||
|
this.labelSpeed.Size = new System.Drawing.Size(59, 15);
|
||||||
|
this.labelSpeed.TabIndex = 0;
|
||||||
|
this.labelSpeed.Text = "Скорость";
|
||||||
|
//
|
||||||
|
// FormLocomotiveConfig
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(693, 248);
|
||||||
|
this.Controls.Add(this.groupBoxConfig);
|
||||||
|
this.Name = "FormLocomotiveConfig";
|
||||||
|
this.Text = "Создание объекта";
|
||||||
|
this.groupBoxConfig.ResumeLayout(false);
|
||||||
|
this.groupBoxConfig.PerformLayout();
|
||||||
|
this.panelObject.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||||
|
this.groupBoxColors.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBoxConfig;
|
||||||
|
private CheckBox checkBoxHasFuelTank;
|
||||||
|
private CheckBox checkBoxHasPipe;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private Label labelWeight;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private Label labelSpeed;
|
||||||
|
private Label labelModifiedObject;
|
||||||
|
private Label labelSimpleObject;
|
||||||
|
private GroupBox groupBoxColors;
|
||||||
|
private Panel panelBlack;
|
||||||
|
private Panel panelAqua;
|
||||||
|
private Panel panelRed;
|
||||||
|
private Panel panelPink;
|
||||||
|
private Panel panelWhite;
|
||||||
|
private Panel panelGreen;
|
||||||
|
private Panel panelYellow;
|
||||||
|
private Panel panelBlue;
|
||||||
|
private Panel panelObject;
|
||||||
|
private PictureBox pictureBoxObject;
|
||||||
|
private Label labelAdditionalColor;
|
||||||
|
private Label labelColor;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonOk;
|
||||||
|
}
|
||||||
|
}
|
||||||
161
Locomotives/Locomotives/FormLocomotiveConfig.cs
Normal file
161
Locomotives/Locomotives/FormLocomotiveConfig.cs
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Форма создания объекта
|
||||||
|
/// </summary>
|
||||||
|
public partial class FormLocomotiveConfig : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Переменная - выбранный локомотив
|
||||||
|
/// </summary>
|
||||||
|
DrawningLocomotive _locomotive = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
|
private event LocomotiveDelegate EventAddLocomotive;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormLocomotiveConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
panelAqua.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPink.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelRed.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||||
|
//Лямбда-выражение для закрытия окна
|
||||||
|
buttonCancel.Click += (sender, e) => Close();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отрисовка локомотива
|
||||||
|
/// </summary>
|
||||||
|
private void DrawLocomotive()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_locomotive?.SetPosition(5, 5, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||||
|
_locomotive?.DrawTransport(gr);
|
||||||
|
pictureBoxObject.Image = bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление события
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ev"></param>
|
||||||
|
public void AddEvent(LocomotiveDelegate ev)
|
||||||
|
{
|
||||||
|
if (EventAddLocomotive == null)
|
||||||
|
{
|
||||||
|
EventAddLocomotive = new LocomotiveDelegate(ev);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EventAddLocomotive += ev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Передаём информацию при нажатии на Label
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Действие при приёме получаемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
switch (e.Data.GetData(DataFormats.Text).ToString())
|
||||||
|
{
|
||||||
|
case "labelSimpleObject":
|
||||||
|
_locomotive = new DrawningLocomotive((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White);
|
||||||
|
break;
|
||||||
|
case "labelModifiedObject":
|
||||||
|
_locomotive = new DrawningWarmlyLocomotive((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, 160, 85, Color.Black, checkBoxHasPipe.Checked, checkBoxHasFuelTank.Checked);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawLocomotive();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Отправляем цвет с панели
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Panel).DoDragDrop((sender as Panel).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проверка получаемой информации
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect= DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Принимаем основной цвет
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
_locomotive.Locomotive.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
DrawLocomotive();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Принимаем дополнительный цвет
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_locomotive.Locomotive is EntityWarmlyLocomotive warmlyLocomotive)
|
||||||
|
{
|
||||||
|
warmlyLocomotive.AdditionalColor = (Color)e.Data.GetData(typeof(Color));
|
||||||
|
}
|
||||||
|
DrawLocomotive();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление локомотива
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddLocomotive?.Invoke(_locomotive);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,7 +57,4 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
</root>
|
||||||
239
Locomotives/Locomotives/FormMap.Designer.cs
generated
239
Locomotives/Locomotives/FormMap.Designer.cs
generated
@@ -1,239 +0,0 @@
|
|||||||
namespace Locomotives
|
|
||||||
{
|
|
||||||
partial class FormMap
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
|
|
||||||
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
|
||||||
this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.toolStripStatusLabelAdditionalColor = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.toolStripStatusLabelHasPipe = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.toolStripStatusLabelHasFuelTank = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.buttonCreate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
|
||||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
|
||||||
this.buttonCreateModif = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
|
|
||||||
this.statusStrip.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxLocomotive
|
|
||||||
//
|
|
||||||
this.pictureBoxLocomotive.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.pictureBoxLocomotive.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.pictureBoxLocomotive.MinimumSize = new System.Drawing.Size(1, 1);
|
|
||||||
this.pictureBoxLocomotive.Name = "pictureBoxLocomotive";
|
|
||||||
this.pictureBoxLocomotive.Size = new System.Drawing.Size(800, 450);
|
|
||||||
this.pictureBoxLocomotive.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
|
||||||
this.pictureBoxLocomotive.TabIndex = 0;
|
|
||||||
this.pictureBoxLocomotive.TabStop = false;
|
|
||||||
//
|
|
||||||
// statusStrip
|
|
||||||
//
|
|
||||||
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.toolStripStatusLabelSpeed,
|
|
||||||
this.toolStripStatusLabelWeight,
|
|
||||||
this.toolStripStatusLabelBodyColor,
|
|
||||||
this.toolStripStatusLabelAdditionalColor,
|
|
||||||
this.toolStripStatusLabelHasPipe,
|
|
||||||
this.toolStripStatusLabelHasFuelTank});
|
|
||||||
this.statusStrip.Location = new System.Drawing.Point(0, 428);
|
|
||||||
this.statusStrip.Name = "statusStrip";
|
|
||||||
this.statusStrip.Size = new System.Drawing.Size(800, 22);
|
|
||||||
this.statusStrip.TabIndex = 1;
|
|
||||||
this.statusStrip.Text = "statusStrip1";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabelSpeed
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
|
|
||||||
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(65, 17);
|
|
||||||
this.toolStripStatusLabelSpeed.Text = "Скорость: ";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabelWeight
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
|
|
||||||
this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(32, 17);
|
|
||||||
this.toolStripStatusLabelWeight.Text = "Вес: ";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabelBodyColor
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor";
|
|
||||||
this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(39, 17);
|
|
||||||
this.toolStripStatusLabelBodyColor.Text = "Цвет: ";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabelAdditionalColor
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabelAdditionalColor.Name = "toolStripStatusLabelAdditionalColor";
|
|
||||||
this.toolStripStatusLabelAdditionalColor.Size = new System.Drawing.Size(137, 17);
|
|
||||||
this.toolStripStatusLabelAdditionalColor.Text = "Дополнительный цвет: ";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabelHasPipe
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabelHasPipe.Name = "toolStripStatusLabelHasPipe";
|
|
||||||
this.toolStripStatusLabelHasPipe.Size = new System.Drawing.Size(99, 17);
|
|
||||||
this.toolStripStatusLabelHasPipe.Text = "Наличие трубы: ";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabelHasFuelTank
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabelHasFuelTank.Name = "toolStripStatusLabelHasFuelTank";
|
|
||||||
this.toolStripStatusLabelHasFuelTank.Size = new System.Drawing.Size(158, 17);
|
|
||||||
this.toolStripStatusLabelHasFuelTank.Text = "Наличие топливного бака: ";
|
|
||||||
//
|
|
||||||
// buttonCreate
|
|
||||||
//
|
|
||||||
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreate.Location = new System.Drawing.Point(12, 395);
|
|
||||||
this.buttonCreate.Name = "buttonCreate";
|
|
||||||
this.buttonCreate.Size = new System.Drawing.Size(90, 30);
|
|
||||||
this.buttonCreate.TabIndex = 2;
|
|
||||||
this.buttonCreate.Text = "Создать";
|
|
||||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreate.Click += new System.EventHandler(this.ButtonCreate_Click);
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonRight.BackgroundImage = global::Locomotives.Properties.Resources.ArrowRight;
|
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
|
||||||
this.buttonRight.Location = new System.Drawing.Point(758, 395);
|
|
||||||
this.buttonRight.Name = "buttonRight";
|
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonRight.TabIndex = 3;
|
|
||||||
this.buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonLeft.BackgroundImage = global::Locomotives.Properties.Resources.ArrowLeft;
|
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(686, 395);
|
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonLeft.TabIndex = 4;
|
|
||||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonDown.BackgroundImage = global::Locomotives.Properties.Resources.ArrowDown;
|
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
|
||||||
this.buttonDown.Location = new System.Drawing.Point(722, 395);
|
|
||||||
this.buttonDown.Name = "buttonDown";
|
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonDown.TabIndex = 5;
|
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonUp.BackgroundImage = global::Locomotives.Properties.Resources.ArrowUp;
|
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
|
||||||
this.buttonUp.Location = new System.Drawing.Point(722, 359);
|
|
||||||
this.buttonUp.Name = "buttonUp";
|
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonUp.TabIndex = 6;
|
|
||||||
this.buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// comboBoxSelectorMap
|
|
||||||
//
|
|
||||||
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.comboBoxSelectorMap.FormattingEnabled = true;
|
|
||||||
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
|
||||||
"Простая карта",
|
|
||||||
"Карта с крестом",
|
|
||||||
"Карта с дорожками"});
|
|
||||||
this.comboBoxSelectorMap.Location = new System.Drawing.Point(12, 12);
|
|
||||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
|
||||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(141, 23);
|
|
||||||
this.comboBoxSelectorMap.TabIndex = 7;
|
|
||||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
|
|
||||||
this.comboBoxSelectorMap.SelectedIndex = 0;
|
|
||||||
//
|
|
||||||
// buttonCreateModif
|
|
||||||
//
|
|
||||||
this.buttonCreateModif.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreateModif.Location = new System.Drawing.Point(108, 395);
|
|
||||||
this.buttonCreateModif.Name = "buttonCreateModif";
|
|
||||||
this.buttonCreateModif.Size = new System.Drawing.Size(109, 30);
|
|
||||||
this.buttonCreateModif.TabIndex = 8;
|
|
||||||
this.buttonCreateModif.Text = "Модификация";
|
|
||||||
this.buttonCreateModif.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
|
||||||
//
|
|
||||||
// FormMap
|
|
||||||
//
|
|
||||||
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.buttonCreateModif);
|
|
||||||
this.Controls.Add(this.comboBoxSelectorMap);
|
|
||||||
this.Controls.Add(this.buttonUp);
|
|
||||||
this.Controls.Add(this.buttonDown);
|
|
||||||
this.Controls.Add(this.buttonLeft);
|
|
||||||
this.Controls.Add(this.buttonRight);
|
|
||||||
this.Controls.Add(this.buttonCreate);
|
|
||||||
this.Controls.Add(this.statusStrip);
|
|
||||||
this.Controls.Add(this.pictureBoxLocomotive);
|
|
||||||
this.Name = "FormMap";
|
|
||||||
this.Text = "Локомотив";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).EndInit();
|
|
||||||
this.statusStrip.ResumeLayout(false);
|
|
||||||
this.statusStrip.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxLocomotive;
|
|
||||||
private StatusStrip statusStrip;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabelSpeed;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabelWeight;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabelBodyColor;
|
|
||||||
private Button buttonCreate;
|
|
||||||
private Button buttonRight;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonUp;
|
|
||||||
private ComboBox comboBoxSelectorMap;
|
|
||||||
private Button buttonCreateModif;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabelAdditionalColor;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabelHasPipe;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabelHasFuelTank;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
namespace Locomotives
|
|
||||||
{
|
|
||||||
public partial class FormMap : Form
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Создание объекта от абстрактного класса карты
|
|
||||||
/// </summary>
|
|
||||||
private AbstractMap _abstractMap;
|
|
||||||
public FormMap()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_abstractMap = new SimpleMap();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Заполнение информации по объекту
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="locomotive">Объект от класса отрисовки или его наследника</param>
|
|
||||||
private void SetData(DrawningLocomotive locomotive)
|
|
||||||
{
|
|
||||||
toolStripStatusLabelSpeed.Text = $"Скорость: {locomotive.Locomotive.Speed}";
|
|
||||||
toolStripStatusLabelWeight.Text = $"Вес: {locomotive.Locomotive.Weight}";
|
|
||||||
toolStripStatusLabelBodyColor.Text = $"Цвет: {locomotive.Locomotive.BodyColor.Name}";
|
|
||||||
toolStripStatusLabelAdditionalColor.Text = $"Дополнительный цвет: н/д";
|
|
||||||
toolStripStatusLabelHasPipe.Text = $"Наличие трубы: н/д";
|
|
||||||
toolStripStatusLabelHasFuelTank.Text = $"Наличие топливного бака: н/д";
|
|
||||||
pictureBoxLocomotive.Image = _abstractMap.CreateMap(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height,
|
|
||||||
new DrawningObjectLocomotive(locomotive));
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Заполнение дополнительной информации по объекту (только для усложнённого объекта)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="warmlylocomotive">Объект от наследника класса отрисовки</param>
|
|
||||||
private void SetAdditionalData(DrawningWarmlyLocomotive warmlylocomotive)
|
|
||||||
{
|
|
||||||
if (warmlylocomotive.Locomotive is EntityWarmlyLocomotive entityWarmlyLocomotive)
|
|
||||||
{
|
|
||||||
toolStripStatusLabelAdditionalColor.Text = $"Дополнительный цвет: {entityWarmlyLocomotive.AdditionalColor.Name}";
|
|
||||||
toolStripStatusLabelHasPipe.Text = $"Наличие трубы: {entityWarmlyLocomotive.HasPipe}";
|
|
||||||
toolStripStatusLabelHasFuelTank.Text = $"Наличие топливного бака: {entityWarmlyLocomotive.HasFuelTank}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Обработка нажатия кнопки "Создать"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random rnd = new();
|
|
||||||
var locomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
|
||||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
|
||||||
SetData(locomotive);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение объекта по форме
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//получаем имя кнопки
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
Direction dir = Direction.None;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
dir = Direction.Up;
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
dir = Direction.Down;
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
dir = Direction.Left;
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
dir = Direction.Right;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pictureBoxLocomotive.Image = _abstractMap?.MoveObject(dir);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Обработка нажатия кнопки "Модификация"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random rnd = new();
|
|
||||||
var locomotive = new DrawningWarmlyLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
|
||||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
|
|
||||||
160, 85,
|
|
||||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(rnd.Next(0, 2)),
|
|
||||||
Convert.ToBoolean(rnd.Next(0, 2)));
|
|
||||||
SetData(locomotive);
|
|
||||||
SetAdditionalData(locomotive);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Смена карты
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
switch (comboBoxSelectorMap.Text)
|
|
||||||
{
|
|
||||||
case "Простая карта":
|
|
||||||
_abstractMap = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "Карта с крестом":
|
|
||||||
_abstractMap = new CrossMap();
|
|
||||||
break;
|
|
||||||
case "Карта с дорожками":
|
|
||||||
_abstractMap = new RoadsMap();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
340
Locomotives/Locomotives/FormMapWithSetLocomotives.Designer.cs
generated
Normal file
340
Locomotives/Locomotives/FormMapWithSetLocomotives.Designer.cs
generated
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
partial class FormMapWithSetLocomotives
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.groupBoxTools = new System.Windows.Forms.GroupBox();
|
||||||
|
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
|
||||||
|
this.buttonDeleteMap = new System.Windows.Forms.Button();
|
||||||
|
this.listBoxMaps = new System.Windows.Forms.ListBox();
|
||||||
|
this.buttonAddMap = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
|
||||||
|
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
||||||
|
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.buttonShowOnMap = new System.Windows.Forms.Button();
|
||||||
|
this.buttonShowStorage = new System.Windows.Forms.Button();
|
||||||
|
this.buttonRemoveLocomotive = new System.Windows.Forms.Button();
|
||||||
|
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
||||||
|
this.buttonAddCar = new System.Windows.Forms.Button();
|
||||||
|
this.pictureBoxLocomotives = new System.Windows.Forms.PictureBox();
|
||||||
|
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
|
this.groupBoxTools.SuspendLayout();
|
||||||
|
this.groupBoxMaps.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).BeginInit();
|
||||||
|
this.menuStrip1.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxTools
|
||||||
|
//
|
||||||
|
this.groupBoxTools.Controls.Add(this.groupBoxMaps);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonUp);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonDown);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonLeft);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonRight);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonShowOnMap);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonShowStorage);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonRemoveLocomotive);
|
||||||
|
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonAddCar);
|
||||||
|
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
|
this.groupBoxTools.Location = new System.Drawing.Point(462, 24);
|
||||||
|
this.groupBoxTools.Name = "groupBoxTools";
|
||||||
|
this.groupBoxTools.Size = new System.Drawing.Size(223, 652);
|
||||||
|
this.groupBoxTools.TabIndex = 0;
|
||||||
|
this.groupBoxTools.TabStop = false;
|
||||||
|
this.groupBoxTools.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// groupBoxMaps
|
||||||
|
//
|
||||||
|
this.groupBoxMaps.Anchor = System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
this.groupBoxMaps.Controls.Add(this.buttonDeleteMap);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.listBoxMaps);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.buttonAddMap);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.textBoxNewMapName);
|
||||||
|
this.groupBoxMaps.Controls.Add(this.comboBoxSelectorMap);
|
||||||
|
this.groupBoxMaps.Location = new System.Drawing.Point(6, 18);
|
||||||
|
this.groupBoxMaps.Name = "groupBoxMaps";
|
||||||
|
this.groupBoxMaps.Size = new System.Drawing.Size(217, 267);
|
||||||
|
this.groupBoxMaps.TabIndex = 11;
|
||||||
|
this.groupBoxMaps.TabStop = false;
|
||||||
|
this.groupBoxMaps.Text = "Карты";
|
||||||
|
//
|
||||||
|
// buttonDeleteMap
|
||||||
|
//
|
||||||
|
this.buttonDeleteMap.Location = new System.Drawing.Point(25, 235);
|
||||||
|
this.buttonDeleteMap.Name = "buttonDeleteMap";
|
||||||
|
this.buttonDeleteMap.Size = new System.Drawing.Size(164, 26);
|
||||||
|
this.buttonDeleteMap.TabIndex = 14;
|
||||||
|
this.buttonDeleteMap.Text = "Удалить карту";
|
||||||
|
this.buttonDeleteMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDeleteMap.Click += new System.EventHandler(this.ButtonDeleteMap_Click);
|
||||||
|
//
|
||||||
|
// listBoxMaps
|
||||||
|
//
|
||||||
|
this.listBoxMaps.FormattingEnabled = true;
|
||||||
|
this.listBoxMaps.ItemHeight = 15;
|
||||||
|
this.listBoxMaps.Location = new System.Drawing.Point(25, 112);
|
||||||
|
this.listBoxMaps.Name = "listBoxMaps";
|
||||||
|
this.listBoxMaps.Size = new System.Drawing.Size(164, 109);
|
||||||
|
this.listBoxMaps.TabIndex = 13;
|
||||||
|
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.ListBoxMaps_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// buttonAddMap
|
||||||
|
//
|
||||||
|
this.buttonAddMap.Location = new System.Drawing.Point(25, 80);
|
||||||
|
this.buttonAddMap.Name = "buttonAddMap";
|
||||||
|
this.buttonAddMap.Size = new System.Drawing.Size(164, 26);
|
||||||
|
this.buttonAddMap.TabIndex = 12;
|
||||||
|
this.buttonAddMap.Text = "Добавить карту";
|
||||||
|
this.buttonAddMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddMap.Click += new System.EventHandler(this.ButtonAddMap_Click);
|
||||||
|
//
|
||||||
|
// textBoxNewMapName
|
||||||
|
//
|
||||||
|
this.textBoxNewMapName.Location = new System.Drawing.Point(25, 22);
|
||||||
|
this.textBoxNewMapName.Name = "textBoxNewMapName";
|
||||||
|
this.textBoxNewMapName.Size = new System.Drawing.Size(164, 23);
|
||||||
|
this.textBoxNewMapName.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// comboBoxSelectorMap
|
||||||
|
//
|
||||||
|
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.comboBoxSelectorMap.FormattingEnabled = true;
|
||||||
|
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
||||||
|
"Простая карта",
|
||||||
|
"Карта с крестом",
|
||||||
|
"Карта с дорожками"});
|
||||||
|
this.comboBoxSelectorMap.Location = new System.Drawing.Point(25, 51);
|
||||||
|
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||||
|
this.comboBoxSelectorMap.Size = new System.Drawing.Size(164, 23);
|
||||||
|
this.comboBoxSelectorMap.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonUp
|
||||||
|
//
|
||||||
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonUp.BackgroundImage = global::Locomotives.Properties.Resources.ArrowUp;
|
||||||
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
|
this.buttonUp.Location = new System.Drawing.Point(107, 580);
|
||||||
|
this.buttonUp.Name = "buttonUp";
|
||||||
|
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonUp.TabIndex = 10;
|
||||||
|
this.buttonUp.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||||
|
//
|
||||||
|
// buttonDown
|
||||||
|
//
|
||||||
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonDown.BackgroundImage = global::Locomotives.Properties.Resources.ArrowDown;
|
||||||
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
|
this.buttonDown.Location = new System.Drawing.Point(107, 616);
|
||||||
|
this.buttonDown.Name = "buttonDown";
|
||||||
|
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonDown.TabIndex = 9;
|
||||||
|
this.buttonDown.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||||
|
//
|
||||||
|
// buttonLeft
|
||||||
|
//
|
||||||
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonLeft.BackgroundImage = global::Locomotives.Properties.Resources.ArrowLeft;
|
||||||
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
|
this.buttonLeft.Location = new System.Drawing.Point(71, 616);
|
||||||
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
|
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonLeft.TabIndex = 8;
|
||||||
|
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||||
|
//
|
||||||
|
// buttonRight
|
||||||
|
//
|
||||||
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.buttonRight.BackgroundImage = global::Locomotives.Properties.Resources.ArrowRight;
|
||||||
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
|
this.buttonRight.Location = new System.Drawing.Point(143, 616);
|
||||||
|
this.buttonRight.Name = "buttonRight";
|
||||||
|
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||||
|
this.buttonRight.TabIndex = 7;
|
||||||
|
this.buttonRight.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||||
|
//
|
||||||
|
// buttonShowOnMap
|
||||||
|
//
|
||||||
|
this.buttonShowOnMap.Location = new System.Drawing.Point(31, 426);
|
||||||
|
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
||||||
|
this.buttonShowOnMap.Size = new System.Drawing.Size(164, 26);
|
||||||
|
this.buttonShowOnMap.TabIndex = 5;
|
||||||
|
this.buttonShowOnMap.Text = "Посмотреть карту";
|
||||||
|
this.buttonShowOnMap.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonShowOnMap.Click += new System.EventHandler(this.ButtonShowOnMap_Click);
|
||||||
|
//
|
||||||
|
// buttonShowStorage
|
||||||
|
//
|
||||||
|
this.buttonShowStorage.Location = new System.Drawing.Point(31, 394);
|
||||||
|
this.buttonShowStorage.Name = "buttonShowStorage";
|
||||||
|
this.buttonShowStorage.Size = new System.Drawing.Size(164, 26);
|
||||||
|
this.buttonShowStorage.TabIndex = 4;
|
||||||
|
this.buttonShowStorage.Text = "Посмотреть хранилище";
|
||||||
|
this.buttonShowStorage.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonShowStorage.Click += new System.EventHandler(this.ButtonShowStorage_Click);
|
||||||
|
//
|
||||||
|
// buttonRemoveLocomotive
|
||||||
|
//
|
||||||
|
this.buttonRemoveLocomotive.Location = new System.Drawing.Point(31, 362);
|
||||||
|
this.buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
|
||||||
|
this.buttonRemoveLocomotive.Size = new System.Drawing.Size(164, 26);
|
||||||
|
this.buttonRemoveLocomotive.TabIndex = 3;
|
||||||
|
this.buttonRemoveLocomotive.Text = "Удалить локомотив";
|
||||||
|
this.buttonRemoveLocomotive.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonRemoveLocomotive.Click += new System.EventHandler(this.ButtonRemoveLocomotive_Click);
|
||||||
|
//
|
||||||
|
// maskedTextBoxPosition
|
||||||
|
//
|
||||||
|
this.maskedTextBoxPosition.Location = new System.Drawing.Point(31, 333);
|
||||||
|
this.maskedTextBoxPosition.Mask = "00";
|
||||||
|
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
|
this.maskedTextBoxPosition.Size = new System.Drawing.Size(164, 23);
|
||||||
|
this.maskedTextBoxPosition.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonAddCar
|
||||||
|
//
|
||||||
|
this.buttonAddCar.Location = new System.Drawing.Point(31, 291);
|
||||||
|
this.buttonAddCar.Name = "buttonAddCar";
|
||||||
|
this.buttonAddCar.Size = new System.Drawing.Size(164, 26);
|
||||||
|
this.buttonAddCar.TabIndex = 1;
|
||||||
|
this.buttonAddCar.Text = "Добавить локомотив";
|
||||||
|
this.buttonAddCar.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddCar.Click += new System.EventHandler(this.ButtonAddLocomotive_Click);
|
||||||
|
//
|
||||||
|
// pictureBoxLocomotives
|
||||||
|
//
|
||||||
|
this.pictureBoxLocomotives.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.pictureBoxLocomotives.Location = new System.Drawing.Point(0, 24);
|
||||||
|
this.pictureBoxLocomotives.Name = "pictureBoxLocomotives";
|
||||||
|
this.pictureBoxLocomotives.Size = new System.Drawing.Size(462, 652);
|
||||||
|
this.pictureBoxLocomotives.TabIndex = 1;
|
||||||
|
this.pictureBoxLocomotives.TabStop = false;
|
||||||
|
//
|
||||||
|
// menuStrip1
|
||||||
|
//
|
||||||
|
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.FileToolStripMenuItem});
|
||||||
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
|
this.menuStrip1.Size = new System.Drawing.Size(685, 24);
|
||||||
|
this.menuStrip1.TabIndex = 2;
|
||||||
|
this.menuStrip1.Text = "menuStrip";
|
||||||
|
//
|
||||||
|
// FileToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.SaveToolStripMenuItem,
|
||||||
|
this.LoadToolStripMenuItem});
|
||||||
|
this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
|
||||||
|
this.FileToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||||
|
this.FileToolStripMenuItem.Text = "Файл";
|
||||||
|
//
|
||||||
|
// SaveToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||||
|
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||||
|
this.SaveToolStripMenuItem.Text = "Сохранение";
|
||||||
|
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// LoadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||||
|
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(141, 22);
|
||||||
|
this.LoadToolStripMenuItem.Text = "Загрузка";
|
||||||
|
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// openFileDialog
|
||||||
|
//
|
||||||
|
this.openFileDialog.Filter = "txt file|*.txt";
|
||||||
|
//
|
||||||
|
// saveFileDialog
|
||||||
|
//
|
||||||
|
this.saveFileDialog.Filter = "txt file|*.txt";
|
||||||
|
//
|
||||||
|
// FormMapWithSetLocomotives
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(685, 676);
|
||||||
|
this.Controls.Add(this.pictureBoxLocomotives);
|
||||||
|
this.Controls.Add(this.groupBoxTools);
|
||||||
|
this.Controls.Add(this.menuStrip1);
|
||||||
|
this.MainMenuStrip = this.menuStrip1;
|
||||||
|
this.Name = "FormMapWithSetLocomotives";
|
||||||
|
this.Text = "Карта с набором объектов";
|
||||||
|
this.groupBoxTools.ResumeLayout(false);
|
||||||
|
this.groupBoxTools.PerformLayout();
|
||||||
|
this.groupBoxMaps.ResumeLayout(false);
|
||||||
|
this.groupBoxMaps.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).EndInit();
|
||||||
|
this.menuStrip1.ResumeLayout(false);
|
||||||
|
this.menuStrip1.PerformLayout();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBoxTools;
|
||||||
|
private PictureBox pictureBoxLocomotives;
|
||||||
|
private ComboBox comboBoxSelectorMap;
|
||||||
|
private Button buttonAddCar;
|
||||||
|
private MaskedTextBox maskedTextBoxPosition;
|
||||||
|
private Button buttonRemoveLocomotive;
|
||||||
|
private Button buttonShowStorage;
|
||||||
|
private Button buttonShowOnMap;
|
||||||
|
private Button buttonUp;
|
||||||
|
private Button buttonDown;
|
||||||
|
private Button buttonLeft;
|
||||||
|
private Button buttonRight;
|
||||||
|
private GroupBox groupBoxMaps;
|
||||||
|
private Button buttonDeleteMap;
|
||||||
|
private ListBox listBoxMaps;
|
||||||
|
private Button buttonAddMap;
|
||||||
|
private TextBox textBoxNewMapName;
|
||||||
|
private MenuStrip menuStrip1;
|
||||||
|
private ToolStripMenuItem FileToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||||
|
private OpenFileDialog openFileDialog;
|
||||||
|
private SaveFileDialog saveFileDialog;
|
||||||
|
}
|
||||||
|
}
|
||||||
300
Locomotives/Locomotives/FormMapWithSetLocomotives.cs
Normal file
300
Locomotives/Locomotives/FormMapWithSetLocomotives.cs
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
using Serilog;
|
||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Форма для работы с набором объектов
|
||||||
|
/// </summary>
|
||||||
|
public partial class FormMapWithSetLocomotives : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Словарь для выпадающего списка
|
||||||
|
/// </summary>
|
||||||
|
private readonly Dictionary<string, AbstractMap> _mapsDict = new()
|
||||||
|
{
|
||||||
|
{"Простая карта", new SimpleMap()},
|
||||||
|
{"Карта с крестом", new CrossMap()},
|
||||||
|
{"Карта с дорожками", new RoadsMap()},
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Объект от коллекции карт
|
||||||
|
/// </summary>
|
||||||
|
private readonly MapsCollection _mapsCollection;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
public FormMapWithSetLocomotives(ILogger logger)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_mapsCollection = new MapsCollection(pictureBoxLocomotives.Width, pictureBoxLocomotives.Height);
|
||||||
|
comboBoxSelectorMap.Items.Clear();
|
||||||
|
foreach (var elem in _mapsDict)
|
||||||
|
{
|
||||||
|
comboBoxSelectorMap.Items.Add(elem.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Заполнение listBoxMaps
|
||||||
|
/// </summary>
|
||||||
|
private void ReloadMaps()
|
||||||
|
{
|
||||||
|
int index = listBoxMaps.SelectedIndex;
|
||||||
|
listBoxMaps.Items.Clear();
|
||||||
|
for (int i = 0; i < _mapsCollection.Keys.Count; i++)
|
||||||
|
{
|
||||||
|
listBoxMaps.Items.Add(_mapsCollection.Keys[i]);
|
||||||
|
}
|
||||||
|
if (listBoxMaps.Items.Count > 0 && (index == -1 || index >=
|
||||||
|
listBoxMaps.Items.Count))
|
||||||
|
{
|
||||||
|
listBoxMaps.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
else if (listBoxMaps.Items.Count > 0 && index > -1 && index <
|
||||||
|
listBoxMaps.Items.Count)
|
||||||
|
{
|
||||||
|
listBoxMaps.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonAddMap_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!_mapsDict.ContainsKey(comboBoxSelectorMap.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
||||||
|
ReloadMaps();
|
||||||
|
_logger.Information($"Создана карта типа {comboBoxSelectorMap.Text} с названием {textBoxNewMapName.Text}");
|
||||||
|
textBoxNewMapName.Text = "";
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Выбор карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
_logger.Information($"Выбрана карта с названием {listBoxMaps.SelectedItem}");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
|
ReloadMaps();
|
||||||
|
_logger.Information($"Удалена карта с названием {listBoxMaps.SelectedItem}");
|
||||||
|
}
|
||||||
|
MessageBox.Show("Карта удалена");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
FormLocomotiveConfig formLocomotiveConfig = new();
|
||||||
|
formLocomotiveConfig.AddEvent(new(AddLocomotive));
|
||||||
|
formLocomotiveConfig.Show();
|
||||||
|
}
|
||||||
|
private void AddLocomotive(DrawningLocomotive locomotive)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ((_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectLocomotive(locomotive)) > -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
_logger.Information($"Добавлен новый объект на карту {listBoxMaps.SelectedItem}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (StorageOverflowException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Ошибка добавления: {ex.Message}");
|
||||||
|
_logger.Warning($"Не удалось добавить объект: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Неизвестная ошибка: {ex.Message}");
|
||||||
|
_logger.Warning($"Не удалось добавить объект: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ((_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos) > -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
_logger.Information($"Удалён объект с карты {listBoxMaps.SelectedItem}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (LocomotiveNotFoundException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Ошибка удаления: {ex.Message}");
|
||||||
|
_logger.Warning($"Не удалось удалить объект: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Неизвестная ошибка: {ex.Message}");
|
||||||
|
_logger.Warning($"Не удалось удалить объект: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод набора
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//получаем имя кнопки
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
Direction dir = Direction.None;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonUp":
|
||||||
|
dir = Direction.Up;
|
||||||
|
break;
|
||||||
|
case "buttonDown":
|
||||||
|
dir = Direction.Down;
|
||||||
|
break;
|
||||||
|
case "buttonLeft":
|
||||||
|
dir = Direction.Left;
|
||||||
|
break;
|
||||||
|
case "buttonRight":
|
||||||
|
dir = Direction.Right;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка нажатия "Сохранение"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mapsCollection.SaveData(saveFileDialog.FileName);
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
_logger.Information($"Коллекция карт сохранена в файл по адресу {saveFileDialog.FileName}");
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.Warning($"Ошибка сохранения файла по адресу {saveFileDialog.FileName}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка нажатия "Загрузка"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_mapsCollection.LoadData(openFileDialog.FileName);
|
||||||
|
MessageBox.Show("Загрузка прошла успешно", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
ReloadMaps();
|
||||||
|
_logger.Information($"Коллекция карт загружена из файла по адресу {openFileDialog.FileName}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Не удалось загрузить файл: {ex.Message}", "Результат",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
_logger.Warning($"Ошибка загрузки файла по адресу {openFileDialog.FileName}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
69
Locomotives/Locomotives/FormMapWithSetLocomotives.resx
Normal file
69
Locomotives/Locomotives/FormMapWithSetLocomotives.resx
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>132, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>265, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
@@ -32,5 +32,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
(float Top, float Bottom, float Left, float Right) GetCurrentPosition();
|
(float Top, float Bottom, float Left, float Right) GetCurrentPosition();
|
||||||
|
/// <summary>
|
||||||
|
/// Получение информации по объекту
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string GetInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
8
Locomotives/Locomotives/LocomotiveDelegate.cs
Normal file
8
Locomotives/Locomotives/LocomotiveDelegate.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Делегат для передачи объекта-локомотива
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="locomotive"></param>
|
||||||
|
public delegate void LocomotiveDelegate(DrawningLocomotive locomotive);
|
||||||
|
}
|
||||||
14
Locomotives/Locomotives/LocomotiveNotFoundException.cs
Normal file
14
Locomotives/Locomotives/LocomotiveNotFoundException.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class LocomotiveNotFoundException : ApplicationException
|
||||||
|
{
|
||||||
|
public LocomotiveNotFoundException(int i) : base($"Не наден объект по позиции {i}") { }
|
||||||
|
public LocomotiveNotFoundException() : base() { }
|
||||||
|
public LocomotiveNotFoundException(string message) : base(message) { }
|
||||||
|
public LocomotiveNotFoundException(string message, Exception Exception) : base(message, Exception) { }
|
||||||
|
protected LocomotiveNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,16 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="appconfig.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="appconfig.json">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -27,4 +37,20 @@
|
|||||||
<Folder Include="Resources\" />
|
<Folder Include="Resources\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Serilog" Version="2.12.0" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.AppSettings" Version="2.2.2" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="3.4.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Delegates" Version="1.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
205
Locomotives/Locomotives/MapWithSetLocomotivesGeneric.cs
Normal file
205
Locomotives/Locomotives/MapWithSetLocomotivesGeneric.cs
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
internal class MapWithSetLocomotivesGeneric<T, U>
|
||||||
|
where T : class, IDrawningObject
|
||||||
|
where U : AbstractMap
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна отрисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна отрисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер занимаемого объектом места (ширина)
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _placeSizeWidth = 210;
|
||||||
|
/// <summary>
|
||||||
|
/// Размер занимаемого объектом места (высота)
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _placeSizeHeight = 110;
|
||||||
|
/// <summary>
|
||||||
|
/// Набор объектов
|
||||||
|
/// </summary>
|
||||||
|
private readonly SetLocomotivesGeneric<T> _setLocomotives;
|
||||||
|
/// <summary>
|
||||||
|
/// Карта
|
||||||
|
/// </summary>
|
||||||
|
private readonly U _map;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="picWidth"></param>
|
||||||
|
/// <param name="picHeight"></param>
|
||||||
|
/// <param name="map"></param>
|
||||||
|
public MapWithSetLocomotivesGeneric(int picWidth, int picHeight, U map)
|
||||||
|
{
|
||||||
|
int width = picWidth / _placeSizeWidth;
|
||||||
|
int height = picHeight / _placeSizeHeight;
|
||||||
|
_setLocomotives = new SetLocomotivesGeneric<T>(width * height);
|
||||||
|
_pictureWidth = picWidth;
|
||||||
|
_pictureHeight = picHeight;
|
||||||
|
_map = map;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора сложения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map"></param>
|
||||||
|
/// <param name="locomotive"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator +(MapWithSetLocomotivesGeneric<T, U> map, T locomotive)
|
||||||
|
{
|
||||||
|
return map._setLocomotives.Insert(locomotive);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перегрузка оператора вычитания
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int operator -(MapWithSetLocomotivesGeneric<T, U> map, int position)
|
||||||
|
{
|
||||||
|
return map._setLocomotives.Remove(position);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вывод всего набора объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Bitmap ShowSet()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
DrawBackground(gr);
|
||||||
|
DrawLocomotives(gr);
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Просмотр объекта на карте
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Bitmap ShowOnMap()
|
||||||
|
{
|
||||||
|
Shaking();
|
||||||
|
foreach (var locomotive in _setLocomotives.GetLocomotives())
|
||||||
|
{
|
||||||
|
return _map.CreateMap(_pictureWidth, _pictureHeight, locomotive);
|
||||||
|
}
|
||||||
|
return new(_pictureWidth, _pictureHeight);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Перемещение объекта по крате
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Bitmap MoveObject(Direction direction)
|
||||||
|
{
|
||||||
|
if (_map != null)
|
||||||
|
{
|
||||||
|
return _map.MoveObject(direction);
|
||||||
|
}
|
||||||
|
return new(_pictureWidth, _pictureHeight);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// "Взбалтываем" набор, чтобы все элементы оказались в начале
|
||||||
|
/// </summary>
|
||||||
|
private void Shaking()
|
||||||
|
{
|
||||||
|
int j = _setLocomotives.Count - 1;
|
||||||
|
for (int i = 0; i < _setLocomotives.Count; i++)
|
||||||
|
{
|
||||||
|
if (_setLocomotives[i] == null)
|
||||||
|
{
|
||||||
|
for (; j > i; j--)
|
||||||
|
{
|
||||||
|
var locomotive = _setLocomotives[j];
|
||||||
|
if (locomotive != null)
|
||||||
|
{
|
||||||
|
_setLocomotives.Insert(locomotive, i);
|
||||||
|
_setLocomotives.Remove(j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (j <= i)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Метод отрисовки фона
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
private void DrawBackground(Graphics g)
|
||||||
|
{
|
||||||
|
Pen pen = new(Color.Brown, 3);
|
||||||
|
Brush brBackground = new SolidBrush(Color.Yellow);
|
||||||
|
g.FillRectangle(brBackground, 0, 0, _pictureWidth, _pictureHeight);
|
||||||
|
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
||||||
|
{//линия разметки места
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i *
|
||||||
|
_placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth,
|
||||||
|
(_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Метод прорисовки объектов
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
|
private void DrawLocomotives(Graphics g)
|
||||||
|
{
|
||||||
|
int LocomotivesInLine = _pictureWidth / _placeSizeWidth;
|
||||||
|
int CurrentVertPos = 20;
|
||||||
|
int CurrentHorPos = 0;
|
||||||
|
int CurrentLocomotiveNumber = 0;
|
||||||
|
foreach (var locomotive in _setLocomotives.GetLocomotives())
|
||||||
|
{
|
||||||
|
_setLocomotives[CurrentLocomotiveNumber]?.SetObject(CurrentHorPos, CurrentVertPos, _pictureWidth, _pictureHeight);
|
||||||
|
_setLocomotives[CurrentLocomotiveNumber]?.DrawningObject(g);
|
||||||
|
if (CurrentHorPos < LocomotivesInLine)
|
||||||
|
{
|
||||||
|
CurrentHorPos += _placeSizeWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentHorPos = 0;
|
||||||
|
CurrentVertPos += _placeSizeHeight;
|
||||||
|
}
|
||||||
|
CurrentLocomotiveNumber++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение данных в виде строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="separatorType"></param>
|
||||||
|
/// <param name="separatorData"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetData(char separatorType, char separatorData)
|
||||||
|
{
|
||||||
|
//Получаем название карты
|
||||||
|
string data = $"{_map.GetType().Name}{separatorType}";
|
||||||
|
foreach (var locomotive in _setLocomotives.GetLocomotives())
|
||||||
|
{
|
||||||
|
data += $"{locomotive.GetInfo()}{separatorData}";
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка списка из массива строк
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="records"></param>
|
||||||
|
public void LoadData(string[] records)
|
||||||
|
{
|
||||||
|
foreach (var record in records)
|
||||||
|
{
|
||||||
|
_setLocomotives.Insert(DrawningObjectLocomotive.Create(record) as T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
128
Locomotives/Locomotives/MapsCollection.cs
Normal file
128
Locomotives/Locomotives/MapsCollection.cs
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
using System.Text;
|
||||||
|
using System.IO;
|
||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс для хранения коллекции карт
|
||||||
|
/// </summary>
|
||||||
|
internal class MapsCollection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Словарь (хранилище) с картами
|
||||||
|
/// </summary>
|
||||||
|
readonly Dictionary<string, MapWithSetLocomotivesGeneric<IDrawningObject, AbstractMap>> _mapStorages;
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращение списка названий карт
|
||||||
|
/// </summary>
|
||||||
|
public List<string> Keys => _mapStorages.Keys.ToList();
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна отрисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна отрисовки
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи информации по элементу словаря в файл
|
||||||
|
/// </summary>
|
||||||
|
private readonly char separatorDict = '|';
|
||||||
|
/// <summary>
|
||||||
|
/// Разделитель для записи коллекции данных в файл
|
||||||
|
/// </summary>
|
||||||
|
private readonly char separatorData = ';';
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pictureWidth"></param>
|
||||||
|
/// <param name="pictureHeight"></param>
|
||||||
|
public MapsCollection(int pictureWidth, int pictureHeight)
|
||||||
|
{
|
||||||
|
_mapStorages = new Dictionary<string, MapWithSetLocomotivesGeneric<IDrawningObject, AbstractMap>>();
|
||||||
|
_pictureWidth = pictureWidth;
|
||||||
|
_pictureHeight = pictureHeight;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название карты</param>
|
||||||
|
/// <param name="map">Карта</param>
|
||||||
|
public void AddMap(string name, AbstractMap map)
|
||||||
|
{
|
||||||
|
_mapStorages.Add(name, new MapWithSetLocomotivesGeneric<IDrawningObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название карты</param>
|
||||||
|
public void DelMap(string name)
|
||||||
|
{
|
||||||
|
_mapStorages.Remove(name);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Доступ к парковке
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ind"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public MapWithSetLocomotivesGeneric<IDrawningObject, AbstractMap> this[string ind]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _mapStorages[ind];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SaveData(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
using (StreamWriter sw = new(filename))
|
||||||
|
{
|
||||||
|
sw.Write("MapsCollection\n");
|
||||||
|
foreach (var storage in _mapStorages)
|
||||||
|
{
|
||||||
|
sw.Write($"{storage.Key}{separatorDict}{storage.Value.GetData(separatorDict, separatorData)}\n");
|
||||||
|
}
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void LoadData(string filename)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
throw new FileNotFoundException("Файл не найдён");
|
||||||
|
}
|
||||||
|
using (StreamReader sr = new(filename))
|
||||||
|
{
|
||||||
|
string firstStr = sr.ReadLine();
|
||||||
|
if (firstStr == null || !firstStr.Contains("MapsCollection"))
|
||||||
|
{
|
||||||
|
//если нет такой записи, то это не те данные
|
||||||
|
throw new FileFormatException("Формат данных в файле неправильный");
|
||||||
|
}
|
||||||
|
string? currentString;
|
||||||
|
while ((currentString = sr.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
var elem = currentString.Split(separatorDict);
|
||||||
|
AbstractMap map = null;
|
||||||
|
switch (elem[1])
|
||||||
|
{
|
||||||
|
case "SimpleMap":
|
||||||
|
map = new SimpleMap();
|
||||||
|
break;
|
||||||
|
case "CrossMap":
|
||||||
|
map = new CrossMap();
|
||||||
|
break;
|
||||||
|
case "RoadsMap":
|
||||||
|
map = new RoadsMap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_mapStorages.Add(elem[0], new MapWithSetLocomotivesGeneric<IDrawningObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
||||||
|
_mapStorages[elem[0]].LoadData(elem[2].Split(separatorData, StringSplitOptions.RemoveEmptyEntries));
|
||||||
|
}
|
||||||
|
sr.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace Locomotives
|
namespace Locomotives
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@@ -8,8 +11,17 @@ namespace Locomotives
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("appconfig.json")
|
||||||
|
.AddJsonFile($"appconfig.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", true)
|
||||||
|
.Build();
|
||||||
|
var Logger = new LoggerConfiguration()
|
||||||
|
.MinimumLevel.Information()
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.CreateLogger();
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormMap());
|
Application.Run(new FormMapWithSetLocomotives(Logger));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
123
Locomotives/Locomotives/SetLocomotivesGeneric.cs
Normal file
123
Locomotives/Locomotives/SetLocomotivesGeneric.cs
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
internal class SetLocomotivesGeneric<T>
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Список объектов, которые храним
|
||||||
|
/// </summary>
|
||||||
|
private readonly List<T> _places;
|
||||||
|
/// <summary>
|
||||||
|
/// Количество объектов в списке
|
||||||
|
/// </summary>
|
||||||
|
public int Count => _places.Count;
|
||||||
|
/// <summary>
|
||||||
|
/// Конструктор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
private readonly int _maxCount;
|
||||||
|
public SetLocomotivesGeneric(int count)
|
||||||
|
{
|
||||||
|
_maxCount = count;
|
||||||
|
_places = new List<T>();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в набор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="locomotive">Добавляемый локомотив</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(T locomotive)
|
||||||
|
{
|
||||||
|
if (_places.Count == 0)
|
||||||
|
{
|
||||||
|
_places.Add(locomotive);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (Count < _maxCount)
|
||||||
|
{
|
||||||
|
for (int i = Count; i >= 1; i--)
|
||||||
|
{
|
||||||
|
_places.Insert(i, _places[i - 1]);
|
||||||
|
_places.RemoveAt(i - 1);
|
||||||
|
}
|
||||||
|
_places.Insert(0, locomotive);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
throw new StorageOverflowException(_places.Count);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="locomotive">Добавляемый локомотив</param>
|
||||||
|
/// <param name="position">Позиция</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Insert(T locomotive, int position)
|
||||||
|
{
|
||||||
|
if (position < 0 || position > Count + 1)
|
||||||
|
{
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
if (_places[position] == null)
|
||||||
|
{
|
||||||
|
_places.Insert(position, locomotive);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
throw new StorageOverflowException(_places.Count);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Удаление объекта из набора с конкретной позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Remove(int position)
|
||||||
|
{
|
||||||
|
if (position >= Count || _places[position] == null)
|
||||||
|
{
|
||||||
|
throw new LocomotiveNotFoundException(position);
|
||||||
|
}
|
||||||
|
_places.RemoveAt(position);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта из набора по позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public T this[int position]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_places[position] != null)
|
||||||
|
{
|
||||||
|
return _places[position];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Insert(value, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Проход по набору до первого пустого
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<T> GetLocomotives()
|
||||||
|
{
|
||||||
|
foreach (var locomotive in _places)
|
||||||
|
{
|
||||||
|
if (locomotive != null)
|
||||||
|
{
|
||||||
|
yield return locomotive;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Locomotives/Locomotives/StorageOverflowException.cs
Normal file
14
Locomotives/Locomotives/StorageOverflowException.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace Locomotives
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
internal class StorageOverflowException : ApplicationException
|
||||||
|
{
|
||||||
|
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count} элементов") { }
|
||||||
|
public StorageOverflowException() : base() { }
|
||||||
|
public StorageOverflowException(string message) : base(message) { }
|
||||||
|
public StorageOverflowException(string message, Exception Exception) : base(message, Exception) { }
|
||||||
|
protected StorageOverflowException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Locomotives/Locomotives/appconfig.json
Normal file
17
Locomotives/Locomotives/appconfig.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"Serilog":
|
||||||
|
{
|
||||||
|
"Using": [ "Serilog.Sinks.File" ],
|
||||||
|
"MinimumLevel": "Information",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args":
|
||||||
|
{
|
||||||
|
"path": "Logs/log.log",
|
||||||
|
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}] {Level}: {Message};{NewLine}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user