Кнопка Select и свойство SelectedLocomotive в FormLocomotive, изменение модификаторов доступа некоторых классов
This commit is contained in:
parent
a2333c47e3
commit
966de1e561
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
namespace Locomotive
|
||||
{
|
||||
//Направление перемещения
|
||||
internal enum Direction
|
||||
public enum Direction
|
||||
{
|
||||
None = 0,
|
||||
Up = 1,
|
||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
namespace Locomotive
|
||||
{
|
||||
//Класс, отвечающий за отрисовку
|
||||
internal class DrawningLocomotive
|
||||
public class DrawningLocomotive
|
||||
{
|
||||
/// Класс-сущность
|
||||
public EntityLocomotive Locomotive { get; protected set; }
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Locomotive
|
||||
{
|
||||
internal class EntityLocomotive
|
||||
public class EntityLocomotive
|
||||
{
|
||||
/// Скорость
|
||||
public int Speed { get; private set; }
|
||||
|
13
Locomotive/Locomotive/FormLocomotive.Designer.cs
generated
13
Locomotive/Locomotive/FormLocomotive.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user