From 966de1e5610b635b2135ec9acde308ab8d2def39 Mon Sep 17 00:00:00 2001 From: Danila_Mochalov Date: Sat, 1 Oct 2022 22:36:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20Select?= =?UTF-8?q?=20=D0=B8=20=D1=81=D0=B2=D0=BE=D0=B9=D1=81=D1=82=D0=B2=D0=BE=20?= =?UTF-8?q?SelectedLocomotive=20=D0=B2=20FormLocomotive,=20=D0=B8=D0=B7?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=82=D0=BE=D1=80=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D1=83=D0=BF=D0=B0=20=D0=BD=D0=B5=D0=BA?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D1=85=20=D0=BA=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=81=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locomotive/Locomotive/Direction.cs | 2 +- Locomotive/Locomotive/DrawningLocomotive.cs | 2 +- Locomotive/Locomotive/EntityLocomotive.cs | 2 +- Locomotive/Locomotive/FormLocomotive.Designer.cs | 13 +++++++++++++ Locomotive/Locomotive/FormLocomotive.cs | 8 ++++++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Locomotive/Locomotive/Direction.cs b/Locomotive/Locomotive/Direction.cs index 81100fc..d2e53fb 100644 --- a/Locomotive/Locomotive/Direction.cs +++ b/Locomotive/Locomotive/Direction.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Locomotive { //Направление перемещения - internal enum Direction + public enum Direction { None = 0, Up = 1, diff --git a/Locomotive/Locomotive/DrawningLocomotive.cs b/Locomotive/Locomotive/DrawningLocomotive.cs index ee0f470..1f4968b 100644 --- a/Locomotive/Locomotive/DrawningLocomotive.cs +++ b/Locomotive/Locomotive/DrawningLocomotive.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Locomotive { //Класс, отвечающий за отрисовку - internal class DrawningLocomotive + public class DrawningLocomotive { /// Класс-сущность public EntityLocomotive Locomotive { get; protected set; } diff --git a/Locomotive/Locomotive/EntityLocomotive.cs b/Locomotive/Locomotive/EntityLocomotive.cs index a546746..866c5a2 100644 --- a/Locomotive/Locomotive/EntityLocomotive.cs +++ b/Locomotive/Locomotive/EntityLocomotive.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Locomotive { - internal class EntityLocomotive + public class EntityLocomotive { /// Скорость public int Speed { get; private set; } diff --git a/Locomotive/Locomotive/FormLocomotive.Designer.cs b/Locomotive/Locomotive/FormLocomotive.Designer.cs index 12c5cba..f57cf18 100644 --- a/Locomotive/Locomotive/FormLocomotive.Designer.cs +++ b/Locomotive/Locomotive/FormLocomotive.Designer.cs @@ -39,6 +39,7 @@ this.buttonDown = new System.Windows.Forms.Button(); this.buttonRight = new System.Windows.Forms.Button(); this.buttonCreateModified = new System.Windows.Forms.Button(); + this.buttonSelectLocomotive = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit(); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); @@ -154,11 +155,22 @@ this.buttonCreateModified.UseVisualStyleBackColor = true; this.buttonCreateModified.Click += new System.EventHandler(this.buttonCreateModified_Click); // + // buttonSelectLocomotive + // + this.buttonSelectLocomotive.Location = new System.Drawing.Point(507, 377); + this.buttonSelectLocomotive.Name = "buttonSelectLocomotive"; + this.buttonSelectLocomotive.Size = new System.Drawing.Size(105, 29); + this.buttonSelectLocomotive.TabIndex = 8; + this.buttonSelectLocomotive.Text = "Select"; + this.buttonSelectLocomotive.UseVisualStyleBackColor = true; + this.buttonSelectLocomotive.Click += new System.EventHandler(this.buttonSelectLocomotive_Click); + // // FormLocomotive // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(778, 442); + this.Controls.Add(this.buttonSelectLocomotive); this.Controls.Add(this.buttonCreateModified); this.Controls.Add(this.buttonRight); this.Controls.Add(this.buttonDown); @@ -190,5 +202,6 @@ private Button buttonDown; private Button buttonRight; private Button buttonCreateModified; + private Button buttonSelectLocomotive; } } \ No newline at end of file diff --git a/Locomotive/Locomotive/FormLocomotive.cs b/Locomotive/Locomotive/FormLocomotive.cs index 4e56d30..567dcdb 100644 --- a/Locomotive/Locomotive/FormLocomotive.cs +++ b/Locomotive/Locomotive/FormLocomotive.cs @@ -4,6 +4,8 @@ namespace Locomotive { private DrawningLocomotive _locomotive; + public DrawningLocomotive SelectedLocomotive { get; private set; } + public FormLocomotive() { InitializeComponent(); @@ -75,5 +77,11 @@ namespace Locomotive SetData(); Draw(); } + + private void buttonSelectLocomotive_Click(object sender, EventArgs e) + { + SelectedLocomotive = _locomotive; + DialogResult = DialogResult.OK; + } } } \ No newline at end of file