laba5 Кувшинов Тимур ПИбд-21 простая #8

Closed
TImourka wants to merge 7 commits from laba5 into laba4
5 changed files with 10 additions and 12 deletions
Showing only changes of commit cfe37b3d42 - Show all commits

View File

@ -10,10 +10,6 @@ namespace Laba1Loco
{
internal class DrawingLoco : DrawingTrain
{
public void setAdditionalColor(Color color)
{
(EntityTrain as EntityLoco).AdditionalColor = color;
}
/// <summary>
/// Инициализация свойств
/// </summary>

View File

@ -10,10 +10,6 @@ namespace Laba1Loco
{
internal class DrawingTrain
{
public void setBodyColor(Color color)
{
EntityTrain.BodyColor = color;
}
public IMoveableObject GetMoveableObject => new DrawningObjectTrain(this);
/// <summary>
/// Класс-сущность

View File

@ -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>

View File

@ -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>

View File

@ -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();