diff --git a/AccordionBus/AccordionBus/AccordionBus.csproj b/AccordionBus/AccordionBus/AccordionBus.csproj
index 663fdb8..af03d74 100644
--- a/AccordionBus/AccordionBus/AccordionBus.csproj
+++ b/AccordionBus/AccordionBus/AccordionBus.csproj
@@ -8,4 +8,19 @@
enable
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/AccordionBus/AccordionBus/DirectionType.cs b/AccordionBus/AccordionBus/DirectionType.cs
new file mode 100644
index 0000000..82de324
--- /dev/null
+++ b/AccordionBus/AccordionBus/DirectionType.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AccordionBus
+{
+ ///
+ /// Направление премещения
+ ///
+ public enum DirectionType
+ {
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+ ///
+ /// Вниз
+ ///
+ Down = 2,
+ ///
+ /// Влево
+ ///
+ Left = 3,
+ ///
+ /// Вправо
+ ///
+ Right = 4
+ }
+}
diff --git a/AccordionBus/AccordionBus/DrawningAccordionBus.cs b/AccordionBus/AccordionBus/DrawningAccordionBus.cs
new file mode 100644
index 0000000..30e7e5f
--- /dev/null
+++ b/AccordionBus/AccordionBus/DrawningAccordionBus.cs
@@ -0,0 +1,246 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AccordionBus
+{
+ ///
+ /// Класс, отвечающий за перемещение и прорисовку объекта-сущности
+ ///
+ public class DrawningAccordionBus
+ {
+ ///
+ /// Класс-сущность
+ ///
+ public EntityAccordionBus? EntityAccordionBus { get; private set; }
+ ///
+ /// Ширина окна
+ ///
+ private int? _pictureWeight;
+ ///
+ /// Высота окна
+ ///
+ private int? _pictureHeight;
+ ///
+ /// Левая координата прорисовки авто
+ ///
+ private int? _startPosX;
+ ///
+ /// Верхняя координата прорисовки авто
+ ///
+ private int? _startPosY;
+ ///
+ /// Ширина прорисовки авто
+ ///
+ private readonly int _drawningBusWeight = 130;
+ ///
+ /// Высота прорисовки авто
+ ///
+ private readonly int _drawningBusHeight = 20;
+ ///
+ /// Инициализация свойств
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void Init(int speed, double weight, Color bodyColor, Color
+ additionalColor, bool threeDoors, bool fourDoors, bool fiveDoors)
+ {
+ EntityAccordionBus = new EntityAccordionBus();
+ EntityAccordionBus.Init(speed, weight, bodyColor, additionalColor,
+ threeDoors, fourDoors, fiveDoors);
+ _pictureWeight = null;
+ _pictureHeight = null;
+ _startPosX = null;
+ _startPosY = null;
+ }
+ ///
+ /// Установка границ поля
+ ///
+ /// Ширина
+ /// Высота
+ /// true - границы заданы, false - проверка не пройдена
+ public bool SetPictureSize(int weight, int height)
+ {
+ if (weight < _drawningBusWeight || height < _drawningBusHeight)
+ {
+ return false;
+ }
+
+ else
+ {
+ _pictureWeight = weight;
+ _pictureHeight = height;
+ return true;
+ }
+ }
+ ///
+ /// Установка позиции
+ ///
+ /// Координата X
+ /// Координата Y
+ public void SetPosition(int x, int y)
+ {
+ if (!_pictureHeight.HasValue || !_pictureWeight.HasValue)
+ {
+ return;
+ }
+
+ if (x + _drawningBusWeight > _pictureWeight)
+ {
+ x -= (int)_pictureWeight - x - _drawningBusWeight;
+ }
+ else if (y + _drawningBusHeight > _pictureHeight)
+ {
+ y -= (int)_pictureHeight - y - _drawningBusHeight;
+ }
+ else
+ {
+ _startPosX = x;
+ _startPosY = y;
+ }
+ }
+ ///
+ /// Перемещение
+ ///
+ /// Направление
+ /// true - перемещение выполнено, false - перемещение невозможнор
+ public bool MoveTransport(DirectionType direction)
+ {
+ if (EntityAccordionBus == null || !_startPosX.HasValue ||
+ !_startPosY.HasValue)
+ {
+ return false;
+ }
+
+ switch (direction)
+ {
+
+ case DirectionType.Left:
+ if (_startPosX.Value - EntityAccordionBus.Step > 0)
+ {
+ _startPosX -= (int)EntityAccordionBus.Step;
+ }
+ return true;
+
+ case DirectionType.Right:
+ if (_startPosX.Value + EntityAccordionBus.Step + _drawningBusWeight < _pictureWeight)
+ {
+ _startPosX += (int)EntityAccordionBus.Step;
+ }
+ return true;
+
+ case DirectionType.Up:
+ if (_startPosY.Value - EntityAccordionBus.Step > 0)
+ {
+ _startPosY -= (int)EntityAccordionBus.Step;
+ }
+ return true;
+
+ case DirectionType.Down:
+ if (_startPosY.Value + EntityAccordionBus.Step + _drawningBusHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityAccordionBus.Step;
+ }
+ return true;
+
+ default:
+ return false;
+ }
+ }
+ ///
+ /// Отрисовка транспорта
+ ///
+ ///
+ public void DrawTransport(Graphics g)
+ {
+ if (EntityAccordionBus == null || !_startPosX.HasValue ||
+ !_startPosY.HasValue)
+ {
+ return;
+ }
+
+ Pen pen = new(Color.Black);
+ Brush additionalBrush = new SolidBrush(EntityAccordionBus.AdditionalColor);
+
+ //корпус
+ Brush br = new SolidBrush(EntityAccordionBus.BodyColor);
+ g.FillRectangle(br, _startPosX.Value, _startPosY.Value, 60, 15);
+ g.FillRectangle(br, _startPosX.Value + 70, _startPosY.Value, 60, 15);
+ g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value, 60, 15);
+ g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value, 60, 15);
+
+ //колёса
+ Brush brWhite = new SolidBrush(Color.White);
+ g.FillEllipse(brWhite, _startPosX.Value + 5, _startPosY.Value + 10, 10, 10);
+ g.FillEllipse(brWhite, _startPosX.Value + 40, _startPosY.Value + 10, 10, 10);
+ g.FillEllipse(brWhite, _startPosX.Value + 75, _startPosY.Value + 10, 10, 10);
+ g.FillEllipse(brWhite, _startPosX.Value + 110, _startPosY.Value + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 110, _startPosY.Value + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 75, _startPosY.Value + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 40, _startPosY.Value + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 10, 10, 10);
+
+ //стёкла
+ Brush brBlue = new SolidBrush(Color.LightBlue);
+ g.FillRectangle(brBlue, _startPosX.Value + 2, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 2, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 12, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 12, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 32, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 42, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 42, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 72, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 72, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 82, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 82, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 92, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 92, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 102, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 102, _startPosY.Value + 3, 5, 5);
+ g.FillRectangle(brBlue, _startPosX.Value + 112, _startPosY.Value + 3, 5, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 112, _startPosY.Value + 3, 5, 5);
+
+ //гормошка
+ g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value, _startPosX.Value + 62, _startPosY.Value + 3);
+ g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 3, _startPosX.Value + 65, _startPosY.Value);
+ g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value, _startPosX.Value + 67, _startPosY.Value + 3);
+ g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 3, _startPosX.Value + 70, _startPosY.Value);
+ g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 15, _startPosX.Value + 62, _startPosY.Value + 12);
+ g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 12, _startPosX.Value + 65, _startPosY.Value + 15);
+ g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value + 15, _startPosX.Value + 67, _startPosY.Value + 12);
+ g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 12, _startPosX.Value + 70, _startPosY.Value + 15);
+ g.DrawLine(pen, _startPosX.Value + 62, _startPosY.Value + 3, _startPosX.Value + 62, _startPosY.Value + 12);
+ g.DrawLine(pen, _startPosX.Value + 67, _startPosY.Value + 3, _startPosX.Value + 67, _startPosY.Value + 12);
+ g.DrawLine(pen, _startPosX.Value + 65, _startPosY.Value, _startPosX.Value + 65, _startPosY.Value + 15);
+
+ //двери
+ g.FillRectangle(additionalBrush, _startPosX.Value + 20, _startPosY.Value + 5, 5, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 5, 5, 10);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 123, _startPosY.Value + 5, 5, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 123, _startPosY.Value + 5, 5, 10);
+ if (EntityAccordionBus.ThreeDoors)
+ {
+ g.FillRectangle(additionalBrush, _startPosX.Value + 53, _startPosY.Value + 5, 5, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 53, _startPosY.Value + 5, 5, 10);
+ }
+ if (EntityAccordionBus.FourDoors)
+ {
+ g.FillRectangle(additionalBrush, _startPosX.Value + 87, _startPosY.Value + 9, 21, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 87, _startPosY.Value + 9, 21, 5);
+ }
+ if (EntityAccordionBus.FiveDoors)
+ {
+ g.FillRectangle(additionalBrush, _startPosX.Value + 27, _startPosY.Value + 9, 11, 5);
+ g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 9, 11, 5);
+ }
+ }
+ }
+}
diff --git a/AccordionBus/AccordionBus/EntityAccordionBus.cs b/AccordionBus/AccordionBus/EntityAccordionBus.cs
new file mode 100644
index 0000000..fabb4c2
--- /dev/null
+++ b/AccordionBus/AccordionBus/EntityAccordionBus.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AccordionBus
+{
+ ///
+ /// класс-сущность "автобус с гормошкой"
+ ///
+ public class EntityAccordionBus
+ {
+ ///
+ /// Скорость
+ ///
+ public int Speed { get; set; }
+ ///
+ /// Вес
+ ///
+ public double Weight { get; set; }
+ ///
+ /// Основной цвет
+ ///
+ public Color BodyColor { get; set; }
+ ///
+ /// Дополнительный цвет
+ ///
+ public Color AdditionalColor { get; set; }
+ ///
+ /// 3 двери
+ ///
+ public bool ThreeDoors { get; set; }
+ ///
+ /// 4 двери
+ ///
+ public bool FourDoors { get; set; }
+ ///
+ /// 5 дверей
+ ///
+ public bool FiveDoors { get; set; }
+ ///
+ /// Шаг
+ ///
+ public double Step => Speed * 100 / Weight;
+ ///
+ /// инициализация полей объекта-класса
+ ///
+ /// Скорость
+ /// вес
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// 3 двери
+ /// 4 двери
+ /// 5 дверей
+ public void Init(int speed, double weight, Color bodyColor, Color
+ additionalColor, bool threeDoors, bool fourDoors, bool fiveDoors)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ ThreeDoors = threeDoors;
+ FourDoors = fourDoors;
+ FiveDoors = fiveDoors;
+ }
+ }
+}
diff --git a/AccordionBus/AccordionBus/Form1.Designer.cs b/AccordionBus/AccordionBus/Form1.Designer.cs
deleted file mode 100644
index 0a997ed..0000000
--- a/AccordionBus/AccordionBus/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace AccordionBus
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
diff --git a/AccordionBus/AccordionBus/Form1.cs b/AccordionBus/AccordionBus/Form1.cs
deleted file mode 100644
index c0505f3..0000000
--- a/AccordionBus/AccordionBus/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace AccordionBus
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/AccordionBus/AccordionBus/FormAccordionBus.Designer.cs b/AccordionBus/AccordionBus/FormAccordionBus.Designer.cs
new file mode 100644
index 0000000..be03cce
--- /dev/null
+++ b/AccordionBus/AccordionBus/FormAccordionBus.Designer.cs
@@ -0,0 +1,141 @@
+namespace AccordionBus
+{
+ partial class FormAccordionBus
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ pictureBoxAccordionBus = new PictureBox();
+ buttonCreate = new Button();
+ ButtonUp = new Button();
+ ButtonRight = new Button();
+ ButtonLeft = new Button();
+ ButtonDown = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAccordionBus).BeginInit();
+ SuspendLayout();
+ //
+ // pictureBoxAccordionBus
+ //
+ pictureBoxAccordionBus.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ pictureBoxAccordionBus.Location = new Point(0, 0);
+ pictureBoxAccordionBus.Name = "pictureBoxAccordionBus";
+ pictureBoxAccordionBus.Size = new Size(882, 453);
+ pictureBoxAccordionBus.SizeMode = PictureBoxSizeMode.AutoSize;
+ pictureBoxAccordionBus.TabIndex = 0;
+ pictureBoxAccordionBus.TabStop = false;
+ //
+ // buttonCreate
+ //
+ buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ buttonCreate.Location = new Point(12, 412);
+ buttonCreate.Name = "buttonCreate";
+ buttonCreate.Size = new Size(94, 29);
+ buttonCreate.TabIndex = 1;
+ buttonCreate.Text = "создать";
+ buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += ButtonCreate_Click;
+ //
+ // ButtonUp
+ //
+ ButtonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ ButtonUp.BackgroundImage = Properties.Resources.buttUp;
+ ButtonUp.BackgroundImageLayout = ImageLayout.Stretch;
+ ButtonUp.ImageAlign = ContentAlignment.MiddleLeft;
+ ButtonUp.Location = new Point(773, 375);
+ ButtonUp.Name = "ButtonUp";
+ ButtonUp.Size = new Size(30, 30);
+ ButtonUp.TabIndex = 2;
+ ButtonUp.UseVisualStyleBackColor = true;
+ ButtonUp.Click += ButtonMove_Click;
+ //
+ // ButtonRight
+ //
+ ButtonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ ButtonRight.BackgroundImage = Properties.Resources.buttRIght;
+ ButtonRight.BackgroundImageLayout = ImageLayout.Stretch;
+ ButtonRight.ImageAlign = ContentAlignment.MiddleLeft;
+ ButtonRight.Location = new Point(809, 411);
+ ButtonRight.Name = "ButtonRight";
+ ButtonRight.Size = new Size(30, 30);
+ ButtonRight.TabIndex = 3;
+ ButtonRight.UseVisualStyleBackColor = true;
+ ButtonRight.Click += ButtonMove_Click;
+ //
+ // ButtonLeft
+ //
+ ButtonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ ButtonLeft.BackgroundImage = Properties.Resources.buttLeft;
+ ButtonLeft.BackgroundImageLayout = ImageLayout.Stretch;
+ ButtonLeft.ImageAlign = ContentAlignment.MiddleLeft;
+ ButtonLeft.Location = new Point(737, 411);
+ ButtonLeft.Name = "ButtonLeft";
+ ButtonLeft.Size = new Size(30, 30);
+ ButtonLeft.TabIndex = 4;
+ ButtonLeft.UseVisualStyleBackColor = true;
+ ButtonLeft.Click += ButtonMove_Click;
+ //
+ // ButtonDown
+ //
+ ButtonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ ButtonDown.BackgroundImage = Properties.Resources.buttDown;
+ ButtonDown.BackgroundImageLayout = ImageLayout.Stretch;
+ ButtonDown.ImageAlign = ContentAlignment.MiddleLeft;
+ ButtonDown.Location = new Point(773, 411);
+ ButtonDown.Name = "ButtonDown";
+ ButtonDown.Size = new Size(30, 30);
+ ButtonDown.TabIndex = 5;
+ ButtonDown.UseVisualStyleBackColor = true;
+ ButtonDown.Click += ButtonMove_Click;
+ //
+ // FormAccordionBus
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(882, 453);
+ Controls.Add(ButtonDown);
+ Controls.Add(ButtonLeft);
+ Controls.Add(ButtonRight);
+ Controls.Add(ButtonUp);
+ Controls.Add(buttonCreate);
+ Controls.Add(pictureBoxAccordionBus);
+ Name = "FormAccordionBus";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Автобус с гормошкой";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAccordionBus).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxAccordionBus;
+ private Button buttonCreate;
+ private Button ButtonUp;
+ private Button ButtonRight;
+ private Button ButtonLeft;
+ private Button ButtonDown;
+ }
+}
\ No newline at end of file
diff --git a/AccordionBus/AccordionBus/FormAccordionBus.cs b/AccordionBus/AccordionBus/FormAccordionBus.cs
new file mode 100644
index 0000000..8716c21
--- /dev/null
+++ b/AccordionBus/AccordionBus/FormAccordionBus.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace AccordionBus
+{
+ public partial class FormAccordionBus : Form
+ {
+ private DrawningAccordionBus? _drawningAccordionBus;
+ public FormAccordionBus()
+ {
+ InitializeComponent();
+ }
+
+ private void Draw()
+ {
+ if (_drawningAccordionBus == null)
+ {
+ return;
+ }
+ Bitmap bmp = new(pictureBoxAccordionBus.Width, pictureBoxAccordionBus.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawningAccordionBus.DrawTransport(gr);
+ pictureBoxAccordionBus.Image = bmp;
+ }
+
+ private void ButtonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new();
+ _drawningAccordionBus = new DrawningAccordionBus();
+ _drawningAccordionBus.Init(random.Next(100, 300), random.Next(1000, 3000),
+ Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)),
+ Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
+ _drawningAccordionBus.SetPictureSize(pictureBoxAccordionBus.Width, pictureBoxAccordionBus.Height);
+ _drawningAccordionBus.SetPosition(random.Next(50, 300), random.Next(50, 300));
+ Draw();
+ }
+
+ private void ButtonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawningAccordionBus == null)
+ {
+ return;
+ }
+
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ bool result = false;
+ switch (name)
+ {
+ case "ButtonUp":
+ result = _drawningAccordionBus.MoveTransport(DirectionType.Up);
+ break;
+ case "ButtonDown":
+ result = _drawningAccordionBus.MoveTransport(DirectionType.Down);
+ break;
+ case "ButtonLeft":
+ result = _drawningAccordionBus.MoveTransport(DirectionType.Left);
+ break;
+ case "ButtonRight":
+ result = _drawningAccordionBus.MoveTransport(DirectionType.Right);
+ break;
+ }
+
+ if (result)
+ {
+ Draw();
+ }
+ }
+ }
+}
diff --git a/AccordionBus/AccordionBus/Form1.resx b/AccordionBus/AccordionBus/FormAccordionBus.resx
similarity index 93%
rename from AccordionBus/AccordionBus/Form1.resx
rename to AccordionBus/AccordionBus/FormAccordionBus.resx
index 1af7de1..af32865 100644
--- a/AccordionBus/AccordionBus/Form1.resx
+++ b/AccordionBus/AccordionBus/FormAccordionBus.resx
@@ -1,17 +1,17 @@
-
diff --git a/AccordionBus/AccordionBus/Program.cs b/AccordionBus/AccordionBus/Program.cs
index 3c106fa..ae15180 100644
--- a/AccordionBus/AccordionBus/Program.cs
+++ b/AccordionBus/AccordionBus/Program.cs
@@ -11,7 +11,7 @@ namespace AccordionBus
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new FormAccordionBus());
}
}
}
\ No newline at end of file
diff --git a/AccordionBus/AccordionBus/Properties/Resources.Designer.cs b/AccordionBus/AccordionBus/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..23deacd
--- /dev/null
+++ b/AccordionBus/AccordionBus/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace AccordionBus.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AccordionBus.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap buttDown {
+ get {
+ object obj = ResourceManager.GetObject("buttDown", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap buttLeft {
+ get {
+ object obj = ResourceManager.GetObject("buttLeft", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap buttRIght {
+ get {
+ object obj = ResourceManager.GetObject("buttRIght", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap buttUp {
+ get {
+ object obj = ResourceManager.GetObject("buttUp", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/AccordionBus/AccordionBus/Properties/Resources.resx b/AccordionBus/AccordionBus/Properties/Resources.resx
new file mode 100644
index 0000000..13d70f8
--- /dev/null
+++ b/AccordionBus/AccordionBus/Properties/Resources.resx
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\buttDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\buttLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\buttRIght.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\buttUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/AccordionBus/AccordionBus/Resources/buttDown.png b/AccordionBus/AccordionBus/Resources/buttDown.png
new file mode 100644
index 0000000..1d75533
Binary files /dev/null and b/AccordionBus/AccordionBus/Resources/buttDown.png differ
diff --git a/AccordionBus/AccordionBus/Resources/buttLeft.png b/AccordionBus/AccordionBus/Resources/buttLeft.png
new file mode 100644
index 0000000..b05b8c5
Binary files /dev/null and b/AccordionBus/AccordionBus/Resources/buttLeft.png differ
diff --git a/AccordionBus/AccordionBus/Resources/buttRIght.png b/AccordionBus/AccordionBus/Resources/buttRIght.png
new file mode 100644
index 0000000..b757389
Binary files /dev/null and b/AccordionBus/AccordionBus/Resources/buttRIght.png differ
diff --git a/AccordionBus/AccordionBus/Resources/buttUp.png b/AccordionBus/AccordionBus/Resources/buttUp.png
new file mode 100644
index 0000000..a982937
Binary files /dev/null and b/AccordionBus/AccordionBus/Resources/buttUp.png differ
diff --git a/AccordionBus/Graphics/buttDown.png b/AccordionBus/Graphics/buttDown.png
new file mode 100644
index 0000000..1d75533
Binary files /dev/null and b/AccordionBus/Graphics/buttDown.png differ
diff --git a/AccordionBus/Graphics/buttLeft.png b/AccordionBus/Graphics/buttLeft.png
new file mode 100644
index 0000000..b05b8c5
Binary files /dev/null and b/AccordionBus/Graphics/buttLeft.png differ
diff --git a/AccordionBus/Graphics/buttRIght.png b/AccordionBus/Graphics/buttRIght.png
new file mode 100644
index 0000000..b757389
Binary files /dev/null and b/AccordionBus/Graphics/buttRIght.png differ
diff --git a/AccordionBus/Graphics/buttUp.png b/AccordionBus/Graphics/buttUp.png
new file mode 100644
index 0000000..a982937
Binary files /dev/null and b/AccordionBus/Graphics/buttUp.png differ