Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b8ab2bb3b | |||
| a77bd466ee | |||
| 12aff45c51 | |||
| a8c4a84c2c | |||
| 299d762c6c | |||
| 47e50542c9 | |||
| 6f8d738bf3 | |||
| 51262a3eb0 | |||
| 8582ebb459 | |||
| a5e35a6759 | |||
| 4d35cc62f5 | |||
| 4da3dba800 | |||
| 607e9493c9 |
@@ -8,7 +8,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Объект от класса отрисовки локомотива
|
/// Объект от класса отрисовки локомотива
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private DrawningLocomotive _locomotive = null;
|
public DrawningLocomotive _locomotive { get; private set; }
|
||||||
public DrawningObjectLocomotive(DrawningLocomotive locomotive)
|
public DrawningObjectLocomotive(DrawningLocomotive locomotive)
|
||||||
{
|
{
|
||||||
_locomotive = locomotive;
|
_locomotive = locomotive;
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -16,9 +16,19 @@
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Конструктор для вызова формы с готовым объектом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name=""></param>
|
||||||
|
/// <param name=""></param>
|
||||||
|
public FormLocomotive(DrawningLocomotive drawningObject)
|
||||||
|
{
|
||||||
|
_locomotive = drawningObject;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Метод отрисовки локомотива
|
/// Метод отрисовки локомотива
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
Bitmap bmp = new(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
|
Bitmap bmp = new(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
@@ -132,10 +142,5 @@
|
|||||||
SelectedLocomotive = _locomotive;
|
SelectedLocomotive = _locomotive;
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonGenerateEntities_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
471
LocomotivesAdvanced/LocomotivesAdvanced/FormLocomotiveConfig.Designer.cs
generated
Normal file
471
LocomotivesAdvanced/LocomotivesAdvanced/FormLocomotiveConfig.Designer.cs
generated
Normal file
@@ -0,0 +1,471 @@
|
|||||||
|
namespace WarmlyLocomotove
|
||||||
|
{
|
||||||
|
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.labelWheelsNumber = new System.Windows.Forms.Label();
|
||||||
|
this.numericUpDownWheelsNumber = new System.Windows.Forms.NumericUpDown();
|
||||||
|
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.labelRectOrnament = new System.Windows.Forms.Label();
|
||||||
|
this.labelEllipseOrnament = new System.Windows.Forms.Label();
|
||||||
|
this.labelNoOrnament = 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();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWheelsNumber)).BeginInit();
|
||||||
|
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.labelWheelsNumber);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.numericUpDownWheelsNumber);
|
||||||
|
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.labelRectOrnament);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.labelEllipseOrnament);
|
||||||
|
this.groupBoxConfig.Controls.Add(this.labelNoOrnament);
|
||||||
|
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, 337);
|
||||||
|
this.groupBoxConfig.TabIndex = 0;
|
||||||
|
this.groupBoxConfig.TabStop = false;
|
||||||
|
this.groupBoxConfig.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// labelWheelsNumber
|
||||||
|
//
|
||||||
|
this.labelWheelsNumber.AutoSize = true;
|
||||||
|
this.labelWheelsNumber.Location = new System.Drawing.Point(233, 195);
|
||||||
|
this.labelWheelsNumber.Name = "labelWheelsNumber";
|
||||||
|
this.labelWheelsNumber.Size = new System.Drawing.Size(107, 15);
|
||||||
|
this.labelWheelsNumber.TabIndex = 1;
|
||||||
|
this.labelWheelsNumber.Text = "Количество колёс";
|
||||||
|
//
|
||||||
|
// numericUpDownWheelsNumber
|
||||||
|
//
|
||||||
|
this.numericUpDownWheelsNumber.Location = new System.Drawing.Point(200, 193);
|
||||||
|
this.numericUpDownWheelsNumber.Maximum = new decimal(new int[] {
|
||||||
|
4,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWheelsNumber.Minimum = new decimal(new int[] {
|
||||||
|
2,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWheelsNumber.Name = "numericUpDownWheelsNumber";
|
||||||
|
this.numericUpDownWheelsNumber.Size = new System.Drawing.Size(27, 23);
|
||||||
|
this.numericUpDownWheelsNumber.TabIndex = 1;
|
||||||
|
this.numericUpDownWheelsNumber.Value = new decimal(new int[] {
|
||||||
|
2,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWheelsNumber.ValueChanged += new System.EventHandler(this.NumericUpDownWheelsNumber_ValueChanged);
|
||||||
|
//
|
||||||
|
// 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);
|
||||||
|
//
|
||||||
|
// labelRectOrnament
|
||||||
|
//
|
||||||
|
this.labelRectOrnament.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelRectOrnament.Location = new System.Drawing.Point(6, 168);
|
||||||
|
this.labelRectOrnament.Name = "labelRectOrnament";
|
||||||
|
this.labelRectOrnament.Size = new System.Drawing.Size(188, 27);
|
||||||
|
this.labelRectOrnament.TabIndex = 7;
|
||||||
|
this.labelRectOrnament.Text = "Прямоугольный орнамент";
|
||||||
|
this.labelRectOrnament.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelRectOrnament.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelOrnament_MouseDown);
|
||||||
|
//
|
||||||
|
// labelEllipseOrnament
|
||||||
|
//
|
||||||
|
this.labelEllipseOrnament.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelEllipseOrnament.Location = new System.Drawing.Point(6, 195);
|
||||||
|
this.labelEllipseOrnament.Name = "labelEllipseOrnament";
|
||||||
|
this.labelEllipseOrnament.Size = new System.Drawing.Size(188, 27);
|
||||||
|
this.labelEllipseOrnament.TabIndex = 7;
|
||||||
|
this.labelEllipseOrnament.Text = "Круглый орнамент";
|
||||||
|
this.labelEllipseOrnament.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelEllipseOrnament.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelOrnament_MouseDown);
|
||||||
|
//
|
||||||
|
// labelNoOrnament
|
||||||
|
//
|
||||||
|
this.labelNoOrnament.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelNoOrnament.Location = new System.Drawing.Point(6, 141);
|
||||||
|
this.labelNoOrnament.Name = "labelNoOrnament";
|
||||||
|
this.labelNoOrnament.Size = new System.Drawing.Size(188, 27);
|
||||||
|
this.labelNoOrnament.TabIndex = 7;
|
||||||
|
this.labelNoOrnament.Text = "Без орнамента";
|
||||||
|
this.labelNoOrnament.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelNoOrnament.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelOrnament_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, 246);
|
||||||
|
this.Controls.Add(this.groupBoxConfig);
|
||||||
|
this.Name = "FormLocomotiveConfig";
|
||||||
|
this.Text = "Создание объекта";
|
||||||
|
this.groupBoxConfig.ResumeLayout(false);
|
||||||
|
this.groupBoxConfig.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWheelsNumber)).EndInit();
|
||||||
|
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;
|
||||||
|
private Label labelRectOrnament;
|
||||||
|
private Label labelEllipseOrnament;
|
||||||
|
private Label labelNoOrnament;
|
||||||
|
private Label labelWheelsNumber;
|
||||||
|
private NumericUpDown numericUpDownWheelsNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
213
LocomotivesAdvanced/LocomotivesAdvanced/FormLocomotiveConfig.cs
Normal file
213
LocomotivesAdvanced/LocomotivesAdvanced/FormLocomotiveConfig.cs
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
namespace WarmlyLocomotove
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Форма создания объекта
|
||||||
|
/// </summary>
|
||||||
|
public partial class FormLocomotiveConfig : Form
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Переменная - выбранный локомотив
|
||||||
|
/// </summary>
|
||||||
|
DrawningLocomotive _locomotive = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Делегат
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="locomotive"></param>
|
||||||
|
public delegate void Action(DrawningLocomotive locomotive);
|
||||||
|
/// <summary>
|
||||||
|
/// Событие
|
||||||
|
/// </summary>
|
||||||
|
private event Action 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(Action ev)
|
||||||
|
{
|
||||||
|
if (EventAddLocomotive == null)
|
||||||
|
{
|
||||||
|
EventAddLocomotive = new Action(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.Data.GetDataPresent(typeof(IDrawningAdditionalElements)))
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||||
|
{
|
||||||
|
_locomotive = new DrawningWarmlyLocomotive((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, 160, 85, Color.Black, checkBoxHasPipe.Checked, checkBoxHasFuelTank.Checked);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (_locomotive != null && e.Data.GetDataPresent(typeof(IDrawningAdditionalElements)))
|
||||||
|
{
|
||||||
|
var ornament = e.Data.GetData(typeof(IDrawningAdditionalElements));
|
||||||
|
_locomotive.AdditionalElements = (IDrawningAdditionalElements)ornament;
|
||||||
|
}
|
||||||
|
_locomotive.AdditionalElements.WheelsNum = (int)numericUpDownWheelsNumber.Value;
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Запоминаем объект от класса доп. прорисовки в переменную типа DataObject
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void LabelOrnament_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
IDrawningAdditionalElements selectedOrnament = new DrawningWheels();
|
||||||
|
switch ((sender as Label).Name)
|
||||||
|
{
|
||||||
|
case "labelNoOrnament":
|
||||||
|
selectedOrnament = new DrawningWheels();
|
||||||
|
break;
|
||||||
|
case "labelRectOrnament":
|
||||||
|
selectedOrnament = new DrawningRectOrnament();
|
||||||
|
break;
|
||||||
|
case "labelEllipseOrnament":
|
||||||
|
selectedOrnament = new DrawningEllipseOrnament();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var dataObj = new DataObject();
|
||||||
|
dataObj.SetData(typeof(IDrawningAdditionalElements), selectedOrnament);
|
||||||
|
(sender as Label).DoDragDrop(dataObj, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Автоматически обновляем количество колёс
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void NumericUpDownWheelsNumber_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_locomotive != null)
|
||||||
|
{
|
||||||
|
_locomotive.AdditionalElements.WheelsNum = (int)numericUpDownWheelsNumber.Value;
|
||||||
|
DrawLocomotive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<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>
|
||||||
|
</root>
|
||||||
@@ -29,6 +29,12 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.groupBoxTools = new System.Windows.Forms.GroupBox();
|
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.buttonUp = new System.Windows.Forms.Button();
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
@@ -38,14 +44,17 @@
|
|||||||
this.buttonRemoveLocomotive = new System.Windows.Forms.Button();
|
this.buttonRemoveLocomotive = new System.Windows.Forms.Button();
|
||||||
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
||||||
this.buttonAddCar = new System.Windows.Forms.Button();
|
this.buttonAddCar = new System.Windows.Forms.Button();
|
||||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
|
||||||
this.pictureBoxLocomotives = new System.Windows.Forms.PictureBox();
|
this.pictureBoxLocomotives = new System.Windows.Forms.PictureBox();
|
||||||
|
this.buttonShowLastRemovedObject = new System.Windows.Forms.Button();
|
||||||
this.groupBoxTools.SuspendLayout();
|
this.groupBoxTools.SuspendLayout();
|
||||||
|
this.groupBoxMaps.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// groupBoxTools
|
// groupBoxTools
|
||||||
//
|
//
|
||||||
|
this.groupBoxTools.Controls.Add(this.buttonShowLastRemovedObject);
|
||||||
|
this.groupBoxTools.Controls.Add(this.groupBoxMaps);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonUp);
|
this.groupBoxTools.Controls.Add(this.buttonUp);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonDown);
|
this.groupBoxTools.Controls.Add(this.buttonDown);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonLeft);
|
this.groupBoxTools.Controls.Add(this.buttonLeft);
|
||||||
@@ -55,21 +64,85 @@
|
|||||||
this.groupBoxTools.Controls.Add(this.buttonRemoveLocomotive);
|
this.groupBoxTools.Controls.Add(this.buttonRemoveLocomotive);
|
||||||
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
||||||
this.groupBoxTools.Controls.Add(this.buttonAddCar);
|
this.groupBoxTools.Controls.Add(this.buttonAddCar);
|
||||||
this.groupBoxTools.Controls.Add(this.comboBoxSelectorMap);
|
|
||||||
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
||||||
this.groupBoxTools.Location = new System.Drawing.Point(577, 0);
|
this.groupBoxTools.Location = new System.Drawing.Point(464, 0);
|
||||||
this.groupBoxTools.Name = "groupBoxTools";
|
this.groupBoxTools.Name = "groupBoxTools";
|
||||||
this.groupBoxTools.Size = new System.Drawing.Size(223, 450);
|
this.groupBoxTools.Size = new System.Drawing.Size(223, 760);
|
||||||
this.groupBoxTools.TabIndex = 0;
|
this.groupBoxTools.TabIndex = 0;
|
||||||
this.groupBoxTools.TabStop = false;
|
this.groupBoxTools.TabStop = false;
|
||||||
this.groupBoxTools.Text = "Инструменты";
|
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, 51);
|
||||||
|
this.groupBoxMaps.Name = "groupBoxMaps";
|
||||||
|
this.groupBoxMaps.Size = new System.Drawing.Size(217, 267);
|
||||||
|
this.groupBoxMaps.TabIndex = 12;
|
||||||
|
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
|
// buttonUp
|
||||||
//
|
//
|
||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonUp.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowUp;
|
this.buttonUp.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowUp;
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonUp.Location = new System.Drawing.Point(107, 378);
|
this.buttonUp.Location = new System.Drawing.Point(107, 688);
|
||||||
this.buttonUp.Name = "buttonUp";
|
this.buttonUp.Name = "buttonUp";
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonUp.TabIndex = 10;
|
this.buttonUp.TabIndex = 10;
|
||||||
@@ -81,7 +154,7 @@
|
|||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonDown.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowDown;
|
this.buttonDown.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowDown;
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonDown.Location = new System.Drawing.Point(107, 414);
|
this.buttonDown.Location = new System.Drawing.Point(107, 724);
|
||||||
this.buttonDown.Name = "buttonDown";
|
this.buttonDown.Name = "buttonDown";
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonDown.TabIndex = 9;
|
this.buttonDown.TabIndex = 9;
|
||||||
@@ -93,7 +166,7 @@
|
|||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonLeft.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowLeft;
|
this.buttonLeft.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowLeft;
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(71, 414);
|
this.buttonLeft.Location = new System.Drawing.Point(71, 724);
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonLeft.TabIndex = 8;
|
this.buttonLeft.TabIndex = 8;
|
||||||
@@ -105,7 +178,7 @@
|
|||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRight.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowRight;
|
this.buttonRight.BackgroundImage = global::WarmlyLocomotive.Properties.Resources.ArrowRight;
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||||
this.buttonRight.Location = new System.Drawing.Point(143, 414);
|
this.buttonRight.Location = new System.Drawing.Point(143, 724);
|
||||||
this.buttonRight.Name = "buttonRight";
|
this.buttonRight.Name = "buttonRight";
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||||
this.buttonRight.TabIndex = 7;
|
this.buttonRight.TabIndex = 7;
|
||||||
@@ -114,7 +187,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowOnMap
|
// buttonShowOnMap
|
||||||
//
|
//
|
||||||
this.buttonShowOnMap.Location = new System.Drawing.Point(31, 314);
|
this.buttonShowOnMap.Location = new System.Drawing.Point(31, 456);
|
||||||
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
||||||
this.buttonShowOnMap.Size = new System.Drawing.Size(164, 26);
|
this.buttonShowOnMap.Size = new System.Drawing.Size(164, 26);
|
||||||
this.buttonShowOnMap.TabIndex = 5;
|
this.buttonShowOnMap.TabIndex = 5;
|
||||||
@@ -124,7 +197,7 @@
|
|||||||
//
|
//
|
||||||
// buttonShowStorage
|
// buttonShowStorage
|
||||||
//
|
//
|
||||||
this.buttonShowStorage.Location = new System.Drawing.Point(31, 217);
|
this.buttonShowStorage.Location = new System.Drawing.Point(31, 424);
|
||||||
this.buttonShowStorage.Name = "buttonShowStorage";
|
this.buttonShowStorage.Name = "buttonShowStorage";
|
||||||
this.buttonShowStorage.Size = new System.Drawing.Size(164, 26);
|
this.buttonShowStorage.Size = new System.Drawing.Size(164, 26);
|
||||||
this.buttonShowStorage.TabIndex = 4;
|
this.buttonShowStorage.TabIndex = 4;
|
||||||
@@ -134,7 +207,7 @@
|
|||||||
//
|
//
|
||||||
// buttonRemoveLocomotive
|
// buttonRemoveLocomotive
|
||||||
//
|
//
|
||||||
this.buttonRemoveLocomotive.Location = new System.Drawing.Point(31, 156);
|
this.buttonRemoveLocomotive.Location = new System.Drawing.Point(31, 392);
|
||||||
this.buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
|
this.buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
|
||||||
this.buttonRemoveLocomotive.Size = new System.Drawing.Size(164, 26);
|
this.buttonRemoveLocomotive.Size = new System.Drawing.Size(164, 26);
|
||||||
this.buttonRemoveLocomotive.TabIndex = 3;
|
this.buttonRemoveLocomotive.TabIndex = 3;
|
||||||
@@ -144,7 +217,7 @@
|
|||||||
//
|
//
|
||||||
// maskedTextBoxPosition
|
// maskedTextBoxPosition
|
||||||
//
|
//
|
||||||
this.maskedTextBoxPosition.Location = new System.Drawing.Point(31, 127);
|
this.maskedTextBoxPosition.Location = new System.Drawing.Point(31, 363);
|
||||||
this.maskedTextBoxPosition.Mask = "00";
|
this.maskedTextBoxPosition.Mask = "00";
|
||||||
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||||
this.maskedTextBoxPosition.Size = new System.Drawing.Size(164, 23);
|
this.maskedTextBoxPosition.Size = new System.Drawing.Size(164, 23);
|
||||||
@@ -152,7 +225,7 @@
|
|||||||
//
|
//
|
||||||
// buttonAddCar
|
// buttonAddCar
|
||||||
//
|
//
|
||||||
this.buttonAddCar.Location = new System.Drawing.Point(31, 72);
|
this.buttonAddCar.Location = new System.Drawing.Point(31, 331);
|
||||||
this.buttonAddCar.Name = "buttonAddCar";
|
this.buttonAddCar.Name = "buttonAddCar";
|
||||||
this.buttonAddCar.Size = new System.Drawing.Size(164, 26);
|
this.buttonAddCar.Size = new System.Drawing.Size(164, 26);
|
||||||
this.buttonAddCar.TabIndex = 1;
|
this.buttonAddCar.TabIndex = 1;
|
||||||
@@ -160,40 +233,38 @@
|
|||||||
this.buttonAddCar.UseVisualStyleBackColor = true;
|
this.buttonAddCar.UseVisualStyleBackColor = true;
|
||||||
this.buttonAddCar.Click += new System.EventHandler(this.ButtonAddLocomotive_Click);
|
this.buttonAddCar.Click += new System.EventHandler(this.ButtonAddLocomotive_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(31, 22);
|
|
||||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
|
||||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(164, 23);
|
|
||||||
this.comboBoxSelectorMap.TabIndex = 0;
|
|
||||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
|
|
||||||
//
|
|
||||||
// pictureBoxLocomotives
|
// pictureBoxLocomotives
|
||||||
//
|
//
|
||||||
this.pictureBoxLocomotives.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pictureBoxLocomotives.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pictureBoxLocomotives.Location = new System.Drawing.Point(0, 0);
|
this.pictureBoxLocomotives.Location = new System.Drawing.Point(0, 0);
|
||||||
this.pictureBoxLocomotives.Name = "pictureBoxLocomotives";
|
this.pictureBoxLocomotives.Name = "pictureBoxLocomotives";
|
||||||
this.pictureBoxLocomotives.Size = new System.Drawing.Size(577, 450);
|
this.pictureBoxLocomotives.Size = new System.Drawing.Size(464, 760);
|
||||||
this.pictureBoxLocomotives.TabIndex = 1;
|
this.pictureBoxLocomotives.TabIndex = 1;
|
||||||
this.pictureBoxLocomotives.TabStop = false;
|
this.pictureBoxLocomotives.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// buttonShowLastRemovedObject
|
||||||
|
//
|
||||||
|
this.buttonShowLastRemovedObject.Location = new System.Drawing.Point(31, 517);
|
||||||
|
this.buttonShowLastRemovedObject.Name = "buttonShowLastRemovedObject";
|
||||||
|
this.buttonShowLastRemovedObject.Size = new System.Drawing.Size(164, 40);
|
||||||
|
this.buttonShowLastRemovedObject.TabIndex = 2;
|
||||||
|
this.buttonShowLastRemovedObject.Text = "Показать последний удалённый элемент";
|
||||||
|
this.buttonShowLastRemovedObject.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonShowLastRemovedObject.Click += new System.EventHandler(this.ButtonShowLastRemovedObject_Click);
|
||||||
|
//
|
||||||
// FormMapWithSetLocomotives
|
// FormMapWithSetLocomotives
|
||||||
//
|
//
|
||||||
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(687, 760);
|
||||||
this.Controls.Add(this.pictureBoxLocomotives);
|
this.Controls.Add(this.pictureBoxLocomotives);
|
||||||
this.Controls.Add(this.groupBoxTools);
|
this.Controls.Add(this.groupBoxTools);
|
||||||
this.Name = "FormMapWithSetLocomotives";
|
this.Name = "FormMapWithSetLocomotives";
|
||||||
this.Text = "Карта с набором объектов";
|
this.Text = "Карта с набором объектов";
|
||||||
this.groupBoxTools.ResumeLayout(false);
|
this.groupBoxTools.ResumeLayout(false);
|
||||||
this.groupBoxTools.PerformLayout();
|
this.groupBoxTools.PerformLayout();
|
||||||
|
this.groupBoxMaps.ResumeLayout(false);
|
||||||
|
this.groupBoxMaps.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotives)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
@@ -213,5 +284,11 @@
|
|||||||
private Button buttonDown;
|
private Button buttonDown;
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
private Button buttonRight;
|
private Button buttonRight;
|
||||||
|
private GroupBox groupBoxMaps;
|
||||||
|
private Button buttonDeleteMap;
|
||||||
|
private ListBox listBoxMaps;
|
||||||
|
private Button buttonAddMap;
|
||||||
|
private TextBox textBoxNewMapName;
|
||||||
|
private Button buttonShowLastRemovedObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,19 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FormMapWithSetLocomotives : Form
|
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;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Объект от класса карты с набором объектов
|
/// Объект от класса карты с набором объектов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -15,38 +28,83 @@
|
|||||||
public FormMapWithSetLocomotives()
|
public FormMapWithSetLocomotives()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_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]);
|
||||||
|
textBoxNewMapName.Text = "";
|
||||||
|
ReloadMaps();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Выбор карты
|
/// Выбор карты
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
private void ListBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AbstractMap map = null;
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
switch (comboBoxSelectorMap.Text)
|
|
||||||
{
|
|
||||||
case "Простая карта":
|
|
||||||
map = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "Карта с крестом":
|
|
||||||
map = new CrossMap();
|
|
||||||
break;
|
|
||||||
case "Карта с дорожками":
|
|
||||||
map = new RoadsMap();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (map != null)
|
/// <summary>
|
||||||
|
/// Удаление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonDeleteMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_mapCarsCollectionGeneric = new
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, AbstractMap>(pictureBoxLocomotives.Width, pictureBoxLocomotives.Height, map);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_mapCarsCollectionGeneric = null;
|
return;
|
||||||
}
|
}
|
||||||
|
if (MessageBox.Show($"Удалить карту {listBoxMaps.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_mapsCollection.DelMap(listBoxMaps.SelectedItem?.ToString() ?? string.Empty);
|
||||||
|
ReloadMaps();
|
||||||
|
}
|
||||||
|
MessageBox.Show("Карта удалена");
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта
|
/// Добавление объекта
|
||||||
@@ -55,25 +113,22 @@
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
|
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapCarsCollectionGeneric == null)
|
FormLocomotiveConfig formLocomotiveConfig = new();
|
||||||
{
|
formLocomotiveConfig.AddEvent(new(AddLocomotive));
|
||||||
return;
|
formLocomotiveConfig.Show();
|
||||||
}
|
}
|
||||||
FormLocomotive form = new();
|
private void AddLocomotive(DrawningLocomotive locomotive)
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
DrawningObjectLocomotive locomotive = new(form.SelectedLocomotive);
|
if ((_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + new DrawningObjectLocomotive(locomotive)) > -1)
|
||||||
if ((_mapCarsCollectionGeneric + locomotive) > -1)
|
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxLocomotives.Image = _mapCarsCollectionGeneric.ShowSet();
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Удаление объекта
|
/// Удаление объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -81,6 +136,10 @@
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
|
private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -90,10 +149,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||||
if ((_mapCarsCollectionGeneric - pos) != null)
|
var removableObject = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty, pos];
|
||||||
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBoxLocomotives.Image = _mapCarsCollectionGeneric.ShowSet();
|
_mapsCollection.RemovedObject = (DrawningObjectLocomotive)removableObject;
|
||||||
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -107,11 +168,11 @@
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapCarsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBoxLocomotives.Image = _mapCarsCollectionGeneric.ShowSet();
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вывод карты
|
/// Вывод карты
|
||||||
@@ -120,11 +181,11 @@
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
private void ButtonShowOnMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapCarsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pictureBoxLocomotives.Image = _mapCarsCollectionGeneric.ShowOnMap();
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowOnMap();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перемещение
|
/// Перемещение
|
||||||
@@ -133,7 +194,7 @@
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_mapCarsCollectionGeneric == null)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -155,7 +216,24 @@
|
|||||||
dir = Direction.Right;
|
dir = Direction.Right;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pictureBoxLocomotives.Image = _mapCarsCollectionGeneric.MoveObject(dir);
|
pictureBoxLocomotives.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].MoveObject(dir);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Вызов формы с последним удалённым элементом
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ButtonShowLastRemovedObject_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_mapsCollection.RemovedObject == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Коллекция удалённых элементов пуста");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FormLocomotive formWithLastRemovedObject = new(_mapsCollection.RemovedObject._locomotive);
|
||||||
|
formWithLastRemovedObject.Show();
|
||||||
|
formWithLastRemovedObject.Draw();
|
||||||
|
_mapsCollection.RemoveLastObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@
|
|||||||
/// Набор объектов
|
/// Набор объектов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly SetLocomotivesGeneric<T> _setLocomotives;
|
private readonly SetLocomotivesGeneric<T> _setLocomotives;
|
||||||
|
public T GetObject(int index)
|
||||||
|
{
|
||||||
|
return _setLocomotives[index];
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Карта
|
/// Карта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -82,14 +86,10 @@
|
|||||||
public Bitmap ShowOnMap()
|
public Bitmap ShowOnMap()
|
||||||
{
|
{
|
||||||
Shaking();
|
Shaking();
|
||||||
for (int i = 0; i < _setLocomotives.Count; i++)
|
foreach (var locomotive in _setLocomotives.GetLocomotives())
|
||||||
{
|
|
||||||
var locomotive = _setLocomotives.Get(i);
|
|
||||||
if (locomotive != null)
|
|
||||||
{
|
{
|
||||||
return _map.CreateMap(_pictureWidth, _pictureHeight, locomotive);
|
return _map.CreateMap(_pictureWidth, _pictureHeight, locomotive);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return new(_pictureWidth, _pictureHeight);
|
return new(_pictureWidth, _pictureHeight);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -113,11 +113,11 @@
|
|||||||
int j = _setLocomotives.Count - 1;
|
int j = _setLocomotives.Count - 1;
|
||||||
for (int i = 0; i < _setLocomotives.Count; i++)
|
for (int i = 0; i < _setLocomotives.Count; i++)
|
||||||
{
|
{
|
||||||
if (_setLocomotives.Get(i) == null)
|
if (_setLocomotives[i] == null)
|
||||||
{
|
{
|
||||||
for (; j > i; j--)
|
for (; j > i; j--)
|
||||||
{
|
{
|
||||||
var locomotive = _setLocomotives.Get(j);
|
var locomotive = _setLocomotives[j];
|
||||||
if (locomotive != null)
|
if (locomotive != null)
|
||||||
{
|
{
|
||||||
_setLocomotives.Insert(locomotive, i);
|
_setLocomotives.Insert(locomotive, i);
|
||||||
@@ -161,10 +161,11 @@
|
|||||||
int LocomotivesInLine = _pictureWidth / _placeSizeWidth;
|
int LocomotivesInLine = _pictureWidth / _placeSizeWidth;
|
||||||
int CurrentVertPos = 20;
|
int CurrentVertPos = 20;
|
||||||
int CurrentHorPos = 0;
|
int CurrentHorPos = 0;
|
||||||
for (int i = 0; i < _setLocomotives.Count; i++)
|
int CurrentLocomotiveNumber = 0;
|
||||||
|
foreach (var locomotive in _setLocomotives.GetLocomotives())
|
||||||
{
|
{
|
||||||
_setLocomotives.Get(i)?.SetObject(CurrentHorPos, CurrentVertPos, _pictureWidth, _pictureHeight);
|
locomotive?.SetObject(CurrentHorPos, CurrentVertPos, _pictureWidth, _pictureHeight);
|
||||||
_setLocomotives.Get(i)?.DrawningObject(g);
|
locomotive?.DrawningObject(g);
|
||||||
if (CurrentHorPos < LocomotivesInLine)
|
if (CurrentHorPos < LocomotivesInLine)
|
||||||
{
|
{
|
||||||
CurrentHorPos += _placeSizeWidth;
|
CurrentHorPos += _placeSizeWidth;
|
||||||
@@ -174,6 +175,7 @@
|
|||||||
CurrentHorPos = 0;
|
CurrentHorPos = 0;
|
||||||
CurrentVertPos += _placeSizeHeight;
|
CurrentVertPos += _placeSizeHeight;
|
||||||
}
|
}
|
||||||
|
CurrentLocomotiveNumber++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
120
LocomotivesAdvanced/LocomotivesAdvanced/MapsCollection.cs
Normal file
120
LocomotivesAdvanced/LocomotivesAdvanced/MapsCollection.cs
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
namespace WarmlyLocomotove
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс для хранения коллекции карт
|
||||||
|
/// </summary>
|
||||||
|
internal class MapsCollection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Словарь (хранилище) с картами
|
||||||
|
/// </summary>
|
||||||
|
readonly Dictionary<string, MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, 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>
|
||||||
|
/// <param name="pictureWidth"></param>
|
||||||
|
/// <param name="pictureHeight"></param>
|
||||||
|
public MapsCollection(int pictureWidth, int pictureHeight)
|
||||||
|
{
|
||||||
|
_mapStorages = new Dictionary<string, MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, AbstractMap>>();
|
||||||
|
_pictureWidth = pictureWidth;
|
||||||
|
_pictureHeight = pictureHeight;
|
||||||
|
_removedObjects = new LinkedList<DrawningObjectLocomotive>();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Добавление карты
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Название карты</param>
|
||||||
|
/// <param name="map">Карта</param>
|
||||||
|
public void AddMap(string name, AbstractMap map)
|
||||||
|
{
|
||||||
|
if (!_mapStorages.ContainsKey(name))
|
||||||
|
{
|
||||||
|
_mapStorages.Add(name, new MapWithSetLocomotivesGeneric<DrawningObjectLocomotive, 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<DrawningObjectLocomotive, AbstractMap> this[string ind]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_mapStorages.ContainsKey(ind))
|
||||||
|
{
|
||||||
|
return _mapStorages[ind];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Индексатор
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dictIndex">Индекс элемента словаря</param>
|
||||||
|
/// <param name="objIndex">Индекс объекта в элементе словаря</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IDrawningObject this[string dictIndex, int objIndex]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_mapStorages.ContainsKey(dictIndex))
|
||||||
|
{
|
||||||
|
var selectedDictElement = _mapStorages[dictIndex];
|
||||||
|
var selectedObject = selectedDictElement.GetObject(objIndex);
|
||||||
|
return selectedObject;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Коллекция удалённых объектов
|
||||||
|
/// </summary>
|
||||||
|
private LinkedList<DrawningObjectLocomotive> _removedObjects;
|
||||||
|
/// <summary>
|
||||||
|
/// Свойство для заполнения коллекции (добавляем в конец, и получаем из конца)
|
||||||
|
/// </summary>
|
||||||
|
public DrawningObjectLocomotive RemovedObject
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_removedObjects.AddLast(value);
|
||||||
|
}
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_removedObjects.Count == 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var removedObject = _removedObjects.Last();
|
||||||
|
return removedObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void RemoveLastObject()
|
||||||
|
{
|
||||||
|
_removedObjects.RemoveLast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ namespace WarmlyLocomotove
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormLocomotiveAdditional());
|
Application.Run(new FormMapWithSetLocomotives());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,18 +6,20 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Массив объектов, которые храним
|
/// Массив объектов, которые храним
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly T[] _places;
|
private readonly List<T> _places;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Количество объектов в массиве
|
/// Количество объектов в списке
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Count => _places.Length;
|
public int Count => _places.Count;
|
||||||
|
private readonly int _maxCount;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="count"></param>
|
/// <param name="count"></param>
|
||||||
public SetLocomotivesGeneric(int count)
|
public SetLocomotivesGeneric(int count)
|
||||||
{
|
{
|
||||||
_places = new T[count];
|
_maxCount = count;
|
||||||
|
_places = new List<T>();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление объекта в набор на конкретную позицию
|
/// Добавление объекта в набор на конкретную позицию
|
||||||
@@ -27,25 +29,16 @@
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int Insert(T locomotive, int position)
|
public int Insert(T locomotive, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= Count)
|
if (position < 0 || position > Count + 1)
|
||||||
{
|
{
|
||||||
return -1;
|
return position;
|
||||||
}
|
}
|
||||||
int ClosestNullElementIndex = position;
|
if (_places.Count == 0)
|
||||||
while (_places[ClosestNullElementIndex] != null)
|
|
||||||
{
|
{
|
||||||
if (ClosestNullElementIndex == Count)
|
_places.Add(locomotive);
|
||||||
{
|
return 0;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
ClosestNullElementIndex++;
|
_places.Insert(position, locomotive);
|
||||||
}
|
|
||||||
while (ClosestNullElementIndex != position)
|
|
||||||
{
|
|
||||||
_places[ClosestNullElementIndex] = _places[ClosestNullElementIndex - 1];
|
|
||||||
ClosestNullElementIndex--;
|
|
||||||
}
|
|
||||||
_places[position] = locomotive;
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -55,12 +48,12 @@
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public T Remove(int position)
|
public T Remove(int position)
|
||||||
{
|
{
|
||||||
if (_places[position] == null)
|
if (position > Count || _places[position] == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var result = _places[position];
|
var result = _places[position];
|
||||||
_places[position] = null;
|
_places.RemoveAt(position);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -68,13 +61,41 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="position"></param>
|
/// <param name="position"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public T Get(int position)
|
public T this[int position]
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
if (_places[position] != null)
|
if (_places[position] != null)
|
||||||
{
|
{
|
||||||
return _places[position];
|
return _places[position];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return null;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user