diff --git a/Locomotives/Locomotives/EntityLocomotive.cs b/Locomotives/Locomotives/EntityLocomotive.cs
index ae09381..843721f 100644
--- a/Locomotives/Locomotives/EntityLocomotive.cs
+++ b/Locomotives/Locomotives/EntityLocomotive.cs
@@ -16,7 +16,7 @@
///
/// Цвет кузова
///
- public Color BodyColor { get; private set; }
+ public Color BodyColor { get; set; }
///
/// Шаг перемещения
///
diff --git a/Locomotives/Locomotives/EntityWarmlyLocomotive.cs b/Locomotives/Locomotives/EntityWarmlyLocomotive.cs
index e8ddb29..732177c 100644
--- a/Locomotives/Locomotives/EntityWarmlyLocomotive.cs
+++ b/Locomotives/Locomotives/EntityWarmlyLocomotive.cs
@@ -8,7 +8,7 @@
///
/// Дополнительный цвет
///
- public Color AdditionalColor { get; private set; }
+ public Color AdditionalColor { get; set; }
///
/// Признак наличия трубы
///
diff --git a/Locomotives/Locomotives/FormLocomotiveConfig.Designer.cs b/Locomotives/Locomotives/FormLocomotiveConfig.Designer.cs
new file mode 100644
index 0000000..a98a487
--- /dev/null
+++ b/Locomotives/Locomotives/FormLocomotiveConfig.Designer.cs
@@ -0,0 +1,391 @@
+namespace Locomotives
+{
+ partial class FormLocomotiveConfig
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ 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;
+ this.checkBoxHasFuelTank.CheckedChanged += new System.EventHandler(this.CheckBoxexAdditionalElements_CheckedChanged);
+ //
+ // 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;
+ this.checkBoxHasPipe.CheckedChanged += new System.EventHandler(this.CheckBoxexAdditionalElements_CheckedChanged);
+ //
+ // 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;
+ }
+}
\ No newline at end of file
diff --git a/Locomotives/Locomotives/FormLocomotiveConfig.cs b/Locomotives/Locomotives/FormLocomotiveConfig.cs
new file mode 100644
index 0000000..2cb2ae7
--- /dev/null
+++ b/Locomotives/Locomotives/FormLocomotiveConfig.cs
@@ -0,0 +1,111 @@
+namespace Locomotives
+{
+ public partial class FormLocomotiveConfig : Form
+ {
+ DrawningLocomotive _locomotive = null;
+ private event LocomotiveDelegate EventAddLocomotive;
+ 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();
+ }
+ 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;
+ }
+ public void AddEvent(LocomotiveDelegate ev)
+ {
+ if (EventAddLocomotive == null)
+ {
+ EventAddLocomotive = new LocomotiveDelegate(ev);
+ }
+ else
+ {
+ EventAddLocomotive += ev;
+ }
+ }
+ private void LabelObject_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ private void PanelObject_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(DataFormats.Text))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ 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();
+ }
+ private void PanelColor_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Panel).DoDragDrop((sender as Panel).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+
+ private void LabelColor_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data.GetDataPresent(typeof(Color)))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect= DragDropEffects.None;
+ }
+ }
+
+ private void LabelColor_DragDrop(object sender, DragEventArgs e)
+ {
+ _locomotive.Locomotive.BodyColor = (Color)e.Data.GetData(typeof(Color));
+ DrawLocomotive();
+ }
+
+ private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_locomotive.Locomotive is EntityWarmlyLocomotive warmlyLocomotive)
+ {
+ warmlyLocomotive.AdditionalColor = (Color)e.Data.GetData(typeof(Color));
+ }
+ DrawLocomotive();
+ }
+
+ private void ButtonOk_Click(object sender, EventArgs e)
+ {
+ EventAddLocomotive?.Invoke(_locomotive);
+ Close();
+ }
+
+ private void CheckBoxexAdditionalElements_CheckedChanged(object sender, EventArgs e)
+ {
+ DrawLocomotive();
+ }
+ }
+}
diff --git a/Locomotives/Locomotives/FormLocomotiveConfig.resx b/Locomotives/Locomotives/FormLocomotiveConfig.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/Locomotives/Locomotives/FormLocomotiveConfig.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Locomotives/Locomotives/FormMapWithSetLocomotives.cs b/Locomotives/Locomotives/FormMapWithSetLocomotives.cs
index bfca24b..ec6a988 100644
--- a/Locomotives/Locomotives/FormMapWithSetLocomotives.cs
+++ b/Locomotives/Locomotives/FormMapWithSetLocomotives.cs
@@ -110,6 +110,10 @@
///
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
{
+ FormLocomotiveConfig formLocomotiveConfig = new();
+ formLocomotiveConfig.AddEvent(new (AddLocomotive));
+ formLocomotiveConfig.Show();
+ /*
if (listBoxMaps.SelectedIndex == -1)
{
return;
@@ -128,6 +132,19 @@
MessageBox.Show("Не удалось добавить объект");
}
}
+ */
+ }
+ private void AddLocomotive(DrawningLocomotive locomotive)
+ {
+ if ((_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectLocomotive(locomotive)) > -1)
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
}
///
/// Удаление объекта
diff --git a/Locomotives/Locomotives/LocomotiveDelegate.cs b/Locomotives/Locomotives/LocomotiveDelegate.cs
new file mode 100644
index 0000000..894767b
--- /dev/null
+++ b/Locomotives/Locomotives/LocomotiveDelegate.cs
@@ -0,0 +1,4 @@
+namespace Locomotives
+{
+ public delegate void LocomotiveDelegate(DrawningLocomotive locomotive);
+}