laba5 Кувшинов Тимур ПИбд-21 простая #8
@ -10,10 +10,6 @@ namespace Laba1Loco
|
||||
{
|
||||
internal class DrawingLoco : DrawingTrain
|
||||
{
|
||||
public void setAdditionalColor(Color color)
|
||||
{
|
||||
(EntityTrain as EntityLoco).AdditionalColor = color;
|
||||
}
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
|
@ -10,10 +10,6 @@ namespace Laba1Loco
|
||||
{
|
||||
internal class DrawingTrain
|
||||
{
|
||||
public void setBodyColor(Color color)
|
||||
{
|
||||
EntityTrain.BodyColor = color;
|
||||
}
|
||||
public IMoveableObject GetMoveableObject => new DrawningObjectTrain(this);
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
|
@ -9,7 +9,10 @@ namespace Laba1Loco
|
||||
{
|
||||
internal class EntityLoco : EntityTrain
|
||||
{
|
||||
public Color AdditionalColor { get; set; }
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public void setAdditionalColor(Color color) { AdditionalColor = color; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак (опция) наличия трубы
|
||||
/// </summary>
|
||||
|
@ -20,7 +20,10 @@ namespace Laba1Loco
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
public void setBodyColor(Color color) { BodyColor = color; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения поезда
|
||||
/// </summary>
|
||||
|
@ -140,12 +140,12 @@ namespace Laba1Loco
|
||||
switch (((Label)sender).Name)
|
||||
{
|
||||
case "labelColor":
|
||||
_train.setBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
_train.EntityTrain.setBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
case "labelAdditionalColor":
|
||||
if (!(_train is DrawingLoco))
|
||||
return;
|
||||
(_train as DrawingLoco).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
(_train.EntityTrain as EntityLoco).setAdditionalColor((Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
}
|
||||
DrawTrain();
|
||||
|
Loading…
Reference in New Issue
Block a user