diff --git a/ElectricLocomotive/ElectricLocomotive/DrawingElectricLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/DrawingElectricLocomotive.cs index 16b18ec..38d51aa 100644 --- a/ElectricLocomotive/ElectricLocomotive/DrawingElectricLocomotive.cs +++ b/ElectricLocomotive/ElectricLocomotive/DrawingElectricLocomotive.cs @@ -31,22 +31,22 @@ namespace ProjectElectricLocomotive.DrawingObjects Brush bodyColor = new SolidBrush(electricLocomotive.BodyColor); g.DrawRectangle(pen, _startPosX + 40, _startPosY + 24, 25, 11); if (electricLocomotive.Compartment) - g.FillPolygon(additionalBrush, new Point[] - { + g.FillPolygon(additionalBrush, new Point[] + { new Point(_startPosX + 61, _startPosY + 25), new Point(_startPosX + 85, _startPosY + 25), new Point(_startPosX + 85, _startPosY + 35), new Point(_startPosX + 61, _startPosY + 35), new Point(_startPosX + 61, _startPosY + 25), - } - ); + } + ); if (electricLocomotive.Pantograph) { g.FillRectangle(blackBrush, _startPosX + 30, _startPosY + 15, 20, 5); g.DrawLine(pen, _startPosX + 30, _startPosY + 15, _startPosX + 50, _startPosY + 2); g.DrawLine(pen, _startPosX + 40, _startPosY + 15, _startPosX + 60, _startPosY + 2); } - base.DrawTransport(g); + base.DrawTransport(g); } public void SetAdditionalColor(Color color) { @@ -54,3 +54,4 @@ namespace ProjectElectricLocomotive.DrawingObjects } } } + diff --git a/ElectricLocomotive/ElectricLocomotive/DrawingLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/DrawingLocomotive.cs index e22cc39..a1e5607 100644 --- a/ElectricLocomotive/ElectricLocomotive/DrawingLocomotive.cs +++ b/ElectricLocomotive/ElectricLocomotive/DrawingLocomotive.cs @@ -13,7 +13,7 @@ namespace ProjectElectricLocomotive.DrawingObjects { public class DrawingLocomotive { - public EntityLocomotive? EntityLocomotive { get; protected set;} + public EntityLocomotive? EntityLocomotive { get; protected set; } public int _pictureWidth; public int _pictureHeight; @@ -172,3 +172,4 @@ namespace ProjectElectricLocomotive.DrawingObjects } } } + diff --git a/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs index dbb6eaa..4bfde99 100644 --- a/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs +++ b/ElectricLocomotive/ElectricLocomotive/EntityElectricLocomotive.cs @@ -10,7 +10,7 @@ namespace ProjectElectricLocomotive.Entities public class EntityElectricLocomotive : EntityLocomotive { public Color AdditionalColor { get; private set; } - public bool Pantograph { get; set; } + public bool Pantograph { get; set; } public bool Compartment { get; set; } /// Дополнительный цвет diff --git a/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs b/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs index aacfbfe..b7b7d30 100644 --- a/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs +++ b/ElectricLocomotive/ElectricLocomotive/EntityLocomotive.cs @@ -16,7 +16,7 @@ namespace ProjectElectricLocomotive.Entities /// Скорость /// Вес локомотива /// Основной цвет - public EntityLocomotive (int speed, double weight, Color bodyColor) + public EntityLocomotive(int speed, double weight, Color bodyColor) { Speed = speed; Weight = weight; @@ -27,4 +27,4 @@ namespace ProjectElectricLocomotive.Entities BodyColor = color; } } -} +} \ No newline at end of file diff --git a/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs b/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs index c9c7157..b856337 100644 --- a/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs +++ b/ElectricLocomotive/ElectricLocomotive/FormLocomotiveConfig.cs @@ -16,7 +16,7 @@ namespace ProjectElectricLocomotive public partial class FormLocomotiveConfig : Form { DrawingLocomotive? _locomotive = null; - private event LocomotiveDelegate? EventAddLocomotive; + private event Action? EventAddLocomotive; public FormLocomotiveConfig() { @@ -33,7 +33,7 @@ namespace ProjectElectricLocomotive buttonCancelObject.Click += (s, e) => Close(); } - public void AddEvent(LocomotiveDelegate ev) + public void AddEvent(Action ev) { if (EventAddLocomotive == null) { @@ -101,7 +101,6 @@ namespace ProjectElectricLocomotive { if (_locomotive == null) return; - ((Label)sender).BackColor = (Color)e.Data.GetData(typeof(Color)); switch (((Label)sender).Name) { case "labelSimpleColor": @@ -119,7 +118,7 @@ namespace ProjectElectricLocomotive } private void LabelColor_DragEnter(object sender, DragEventArgs e) { - if (e.Data?.GetDataPresent(typeof(Color)) ?? false) + if ((e.Data?.GetDataPresent(typeof(Color)) ?? false)) { e.Effect = DragDropEffects.Copy; } diff --git a/ElectricLocomotive/ElectricLocomotive/LocomotiveDelegate.cs b/ElectricLocomotive/ElectricLocomotive/LocomotiveDelegate.cs deleted file mode 100644 index 5139dd2..0000000 --- a/ElectricLocomotive/ElectricLocomotive/LocomotiveDelegate.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ProjectElectricLocomotive.DrawingObjects; - -namespace ProjectElectricLocomotive -{ - public delegate void LocomotiveDelegate(DrawingLocomotive locomotive); -}