From e3a0583302b102fba823601f3a2ff8ebae7d9125 Mon Sep 17 00:00:00 2001 From: Factorino73 Date: Sat, 11 Nov 2023 20:30:18 +0400 Subject: [PATCH] PIbd-21_MasenkinMS_LabWork05 --- .../AccordionBus/BusCollectionForm.cs | 19 +- .../AccordionBus/BusConfigForm.Designer.cs | 369 ++++++++++++++++++ AccordionBus/AccordionBus/BusConfigForm.cs | 198 ++++++++++ AccordionBus/AccordionBus/BusConfigForm.resx | 120 ++++++ AccordionBus/AccordionBus/BusDelegate.cs | 15 + .../AccordionBus/DrawingAccordionBus.cs | 12 + AccordionBus/AccordionBus/DrawingBus.cs | 9 + .../AccordionBus/EntityAccordionBus.cs | 9 + AccordionBus/AccordionBus/EntityBus.cs | 9 + 9 files changed, 751 insertions(+), 9 deletions(-) create mode 100644 AccordionBus/AccordionBus/BusConfigForm.Designer.cs create mode 100644 AccordionBus/AccordionBus/BusConfigForm.cs create mode 100644 AccordionBus/AccordionBus/BusConfigForm.resx create mode 100644 AccordionBus/AccordionBus/BusDelegate.cs diff --git a/AccordionBus/AccordionBus/BusCollectionForm.cs b/AccordionBus/AccordionBus/BusCollectionForm.cs index 64dc52d..5534fd4 100644 --- a/AccordionBus/AccordionBus/BusCollectionForm.cs +++ b/AccordionBus/AccordionBus/BusCollectionForm.cs @@ -114,16 +114,16 @@ namespace AccordionBus return; } - var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty]; - if (obj == null) + BusConfigForm form = new BusConfigForm(); + form.AddEvent(bus => { - return; - } + var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty]; + if (obj == null) + { + return; + } - AccordionBusForm form = new(); - if (form.ShowDialog() == DialogResult.OK) - { - if (obj + form.SelectedBus > -1) + if (obj + bus > -1) { MessageBox.Show("Объект добавлен"); pictureBoxCollection.Image = obj.ShowBuses(); @@ -132,7 +132,8 @@ namespace AccordionBus { MessageBox.Show("Не удалось добавить объект"); } - } + }); + form.Show(); } /// diff --git a/AccordionBus/AccordionBus/BusConfigForm.Designer.cs b/AccordionBus/AccordionBus/BusConfigForm.Designer.cs new file mode 100644 index 0000000..010858e --- /dev/null +++ b/AccordionBus/AccordionBus/BusConfigForm.Designer.cs @@ -0,0 +1,369 @@ +namespace AccordionBus +{ + partial class BusConfigForm + { + /// + /// 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() + { + groupBoxParameters = new GroupBox(); + labelModifiedObject = new Label(); + labelSimpleObject = new Label(); + groupBoxColors = new GroupBox(); + panelMagenta = new Panel(); + panelBlack = new Panel(); + panelGray = new Panel(); + panelWhite = new Panel(); + panelYellow = new Panel(); + panelBlue = new Panel(); + panelGreen = new Panel(); + panelRed = new Panel(); + checkBoxAdditionalDoor = new CheckBox(); + checkBoxAdditionalBody = new CheckBox(); + numericUpDownWeight = new NumericUpDown(); + labelWeight = new Label(); + numericUpDownSpeed = new NumericUpDown(); + labelSpeed = new Label(); + panelObject = new Panel(); + pictureBoxObject = new PictureBox(); + labelAdditionalColor = new Label(); + labelBodyColor = new Label(); + buttonAdd = new Button(); + buttonCancel = new Button(); + groupBoxParameters.SuspendLayout(); + groupBoxColors.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit(); + panelObject.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit(); + SuspendLayout(); + // + // groupBoxParameters + // + groupBoxParameters.Controls.Add(labelModifiedObject); + groupBoxParameters.Controls.Add(labelSimpleObject); + groupBoxParameters.Controls.Add(groupBoxColors); + groupBoxParameters.Controls.Add(checkBoxAdditionalDoor); + groupBoxParameters.Controls.Add(checkBoxAdditionalBody); + groupBoxParameters.Controls.Add(numericUpDownWeight); + groupBoxParameters.Controls.Add(labelWeight); + groupBoxParameters.Controls.Add(numericUpDownSpeed); + groupBoxParameters.Controls.Add(labelSpeed); + groupBoxParameters.Dock = DockStyle.Left; + groupBoxParameters.Location = new Point(0, 0); + groupBoxParameters.Name = "groupBoxParameters"; + groupBoxParameters.Size = new Size(553, 231); + groupBoxParameters.TabIndex = 0; + groupBoxParameters.TabStop = false; + groupBoxParameters.Text = "Параметры"; + // + // labelModifiedObject + // + labelModifiedObject.BorderStyle = BorderStyle.FixedSingle; + labelModifiedObject.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelModifiedObject.Location = new Point(410, 185); + labelModifiedObject.Name = "labelModifiedObject"; + labelModifiedObject.Size = new Size(120, 30); + labelModifiedObject.TabIndex = 8; + labelModifiedObject.Text = "Продвинутый"; + labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter; + labelModifiedObject.MouseDown += labelObject_MouseDown; + // + // labelSimpleObject + // + labelSimpleObject.BorderStyle = BorderStyle.FixedSingle; + labelSimpleObject.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelSimpleObject.Location = new Point(270, 185); + labelSimpleObject.Name = "labelSimpleObject"; + labelSimpleObject.Size = new Size(120, 30); + labelSimpleObject.TabIndex = 7; + labelSimpleObject.Text = "Простой"; + labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter; + labelSimpleObject.MouseDown += labelObject_MouseDown; + // + // groupBoxColors + // + groupBoxColors.Controls.Add(panelMagenta); + groupBoxColors.Controls.Add(panelBlack); + groupBoxColors.Controls.Add(panelGray); + groupBoxColors.Controls.Add(panelWhite); + groupBoxColors.Controls.Add(panelYellow); + groupBoxColors.Controls.Add(panelBlue); + groupBoxColors.Controls.Add(panelGreen); + groupBoxColors.Controls.Add(panelRed); + groupBoxColors.Location = new Point(260, 30); + groupBoxColors.Name = "groupBoxColors"; + groupBoxColors.Size = new Size(280, 140); + groupBoxColors.TabIndex = 6; + groupBoxColors.TabStop = false; + groupBoxColors.Text = "Цвета"; + // + // panelMagenta + // + panelMagenta.BackColor = Color.Magenta; + panelMagenta.BorderStyle = BorderStyle.FixedSingle; + panelMagenta.Location = new Point(220, 80); + panelMagenta.Name = "panelMagenta"; + panelMagenta.Size = new Size(50, 50); + panelMagenta.TabIndex = 7; + // + // panelBlack + // + panelBlack.BackColor = Color.Black; + panelBlack.BorderStyle = BorderStyle.FixedSingle; + panelBlack.Location = new Point(150, 80); + panelBlack.Name = "panelBlack"; + panelBlack.Size = new Size(50, 50); + panelBlack.TabIndex = 6; + // + // panelGray + // + panelGray.BackColor = Color.Gray; + panelGray.BorderStyle = BorderStyle.FixedSingle; + panelGray.Location = new Point(80, 80); + panelGray.Name = "panelGray"; + panelGray.Size = new Size(50, 50); + panelGray.TabIndex = 5; + // + // panelWhite + // + panelWhite.BackColor = Color.White; + panelWhite.BorderStyle = BorderStyle.FixedSingle; + panelWhite.Location = new Point(10, 80); + panelWhite.Name = "panelWhite"; + panelWhite.Size = new Size(50, 50); + panelWhite.TabIndex = 4; + // + // panelYellow + // + panelYellow.BackColor = Color.Yellow; + panelYellow.BorderStyle = BorderStyle.FixedSingle; + panelYellow.Location = new Point(220, 20); + panelYellow.Name = "panelYellow"; + panelYellow.Size = new Size(50, 50); + panelYellow.TabIndex = 3; + // + // panelBlue + // + panelBlue.BackColor = Color.Blue; + panelBlue.BorderStyle = BorderStyle.FixedSingle; + panelBlue.Location = new Point(150, 20); + panelBlue.Name = "panelBlue"; + panelBlue.Size = new Size(50, 50); + panelBlue.TabIndex = 2; + // + // panelGreen + // + panelGreen.BackColor = Color.Green; + panelGreen.BorderStyle = BorderStyle.FixedSingle; + panelGreen.Location = new Point(80, 20); + panelGreen.Name = "panelGreen"; + panelGreen.Size = new Size(50, 50); + panelGreen.TabIndex = 1; + // + // panelRed + // + panelRed.BackColor = Color.Red; + panelRed.BorderStyle = BorderStyle.FixedSingle; + panelRed.Location = new Point(10, 20); + panelRed.Name = "panelRed"; + panelRed.Size = new Size(50, 50); + panelRed.TabIndex = 0; + // + // checkBoxAdditionalDoor + // + checkBoxAdditionalDoor.AutoSize = true; + checkBoxAdditionalDoor.Location = new Point(30, 180); + checkBoxAdditionalDoor.Name = "checkBoxAdditionalDoor"; + checkBoxAdditionalDoor.Size = new Size(154, 34); + checkBoxAdditionalDoor.TabIndex = 5; + checkBoxAdditionalDoor.Text = "Признак наличия\r\nдополнительной двери"; + checkBoxAdditionalDoor.UseVisualStyleBackColor = true; + // + // checkBoxAdditionalBody + // + checkBoxAdditionalBody.AutoSize = true; + checkBoxAdditionalBody.Location = new Point(30, 140); + checkBoxAdditionalBody.Name = "checkBoxAdditionalBody"; + checkBoxAdditionalBody.Size = new Size(163, 34); + checkBoxAdditionalBody.TabIndex = 4; + checkBoxAdditionalBody.Text = "Признак наличия\r\nдополнительного отсека"; + checkBoxAdditionalBody.UseVisualStyleBackColor = true; + // + // numericUpDownWeight + // + numericUpDownWeight.Location = new Point(110, 70); + numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); + numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); + numericUpDownWeight.Name = "numericUpDownWeight"; + numericUpDownWeight.Size = new Size(120, 23); + numericUpDownWeight.TabIndex = 3; + numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // labelWeight + // + labelWeight.AutoSize = true; + labelWeight.Location = new Point(30, 70); + labelWeight.Name = "labelWeight"; + labelWeight.Size = new Size(29, 15); + labelWeight.TabIndex = 2; + labelWeight.Text = "Вес:"; + // + // numericUpDownSpeed + // + numericUpDownSpeed.Location = new Point(110, 30); + numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); + numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); + numericUpDownSpeed.Name = "numericUpDownSpeed"; + numericUpDownSpeed.Size = new Size(120, 23); + numericUpDownSpeed.TabIndex = 1; + numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // labelSpeed + // + labelSpeed.AutoSize = true; + labelSpeed.Location = new Point(30, 30); + labelSpeed.Name = "labelSpeed"; + labelSpeed.Size = new Size(62, 15); + labelSpeed.TabIndex = 0; + labelSpeed.Text = "Скорость:"; + // + // panelObject + // + panelObject.AllowDrop = true; + panelObject.Controls.Add(pictureBoxObject); + panelObject.Controls.Add(labelAdditionalColor); + panelObject.Controls.Add(labelBodyColor); + panelObject.Location = new Point(549, 0); + panelObject.Name = "panelObject"; + panelObject.Size = new Size(335, 188); + panelObject.TabIndex = 10; + panelObject.DragDrop += panelObject_DragDrop; + panelObject.DragEnter += panelObject_DragEnter; + // + // pictureBoxObject + // + pictureBoxObject.Location = new Point(20, 50); + pictureBoxObject.Name = "pictureBoxObject"; + pictureBoxObject.Size = new Size(302, 124); + pictureBoxObject.TabIndex = 10; + pictureBoxObject.TabStop = false; + // + // labelAdditionalColor + // + labelAdditionalColor.AllowDrop = true; + labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle; + labelAdditionalColor.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelAdditionalColor.Location = new Point(200, 10); + labelAdditionalColor.Name = "labelAdditionalColor"; + labelAdditionalColor.Size = new Size(120, 30); + labelAdditionalColor.TabIndex = 9; + labelAdditionalColor.Text = "Доп. цвет"; + labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter; + labelAdditionalColor.DragDrop += labelAdditionalColor_DragDrop; + labelAdditionalColor.DragEnter += labelColor_DragEnter; + // + // labelBodyColor + // + labelBodyColor.AllowDrop = true; + labelBodyColor.BorderStyle = BorderStyle.FixedSingle; + labelBodyColor.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + labelBodyColor.Location = new Point(20, 10); + labelBodyColor.Name = "labelBodyColor"; + labelBodyColor.Size = new Size(120, 30); + labelBodyColor.TabIndex = 8; + labelBodyColor.Text = "Осн. цвет"; + labelBodyColor.TextAlign = ContentAlignment.MiddleCenter; + labelBodyColor.DragDrop += labelBodyColor_DragDrop; + labelBodyColor.DragEnter += labelColor_DragEnter; + // + // buttonAdd + // + buttonAdd.Location = new Point(569, 196); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(120, 30); + buttonAdd.TabIndex = 11; + buttonAdd.Text = "Добавить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(749, 196); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(120, 30); + buttonCancel.TabIndex = 12; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + // + // BusConfigForm + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(884, 231); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(panelObject); + Controls.Add(groupBoxParameters); + Name = "BusConfigForm"; + Text = "Создание объекта"; + groupBoxParameters.ResumeLayout(false); + groupBoxParameters.PerformLayout(); + groupBoxColors.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit(); + panelObject.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit(); + ResumeLayout(false); + } + + #endregion + + private GroupBox groupBoxParameters; + private NumericUpDown numericUpDownWeight; + private Label labelWeight; + private NumericUpDown numericUpDownSpeed; + private Label labelSpeed; + private CheckBox checkBoxAdditionalBody; + private GroupBox groupBoxColors; + private Panel panelRed; + private CheckBox checkBoxAdditionalDoor; + private Panel panelGreen; + private Panel panelMagenta; + private Panel panelBlack; + private Panel panelGray; + private Panel panelWhite; + private Panel panelYellow; + private Panel panelBlue; + private Label labelSimpleObject; + private Label labelModifiedObject; + private Panel panelObject; + private PictureBox pictureBoxObject; + private Label labelAdditionalColor; + private Label labelBodyColor; + private Button buttonAdd; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/AccordionBus/AccordionBus/BusConfigForm.cs b/AccordionBus/AccordionBus/BusConfigForm.cs new file mode 100644 index 0000000..3c59b22 --- /dev/null +++ b/AccordionBus/AccordionBus/BusConfigForm.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics.Tracing; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using AccordionBus.Drawings; + +namespace AccordionBus +{ + public partial class BusConfigForm : Form + { + /// + /// Переменная-выбранный автобус + /// + DrawingBus? _bus = null; + + /// + /// Событие + /// + private event Action EventAddBus; + + /// + /// Конструктор + /// + public BusConfigForm() + { + InitializeComponent(); + panelRed.MouseDown += panelColor_MouseDown; + panelGreen.MouseDown += panelColor_MouseDown; + panelBlue.MouseDown += panelColor_MouseDown; + panelYellow.MouseDown += panelColor_MouseDown; + panelWhite.MouseDown += panelColor_MouseDown; + panelGray.MouseDown += panelColor_MouseDown; + panelBlack.MouseDown += panelColor_MouseDown; + panelMagenta.MouseDown += panelColor_MouseDown; + + buttonCancel.Click += (sender, e) => Close(); + } + + /// + /// Отрисовать автобус + /// + private void DrawBus() + { + Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height); + Graphics gr = Graphics.FromImage(bmp); + _bus?.SetPosition((pictureBoxObject.Width - _bus.GetWidth) / 2, (pictureBoxObject.Height - _bus.GetHeight) / 2); + _bus?.DrawTransport(gr); + pictureBoxObject.Image = bmp; + } + + /// + /// Добавление события + /// + /// Событие + public void AddEvent(Action ev) + { + if (EventAddBus == null) + { + EventAddBus = ev; + } + else + { + EventAddBus += ev; + } + } + + /// + /// Передаем информацию при нажатии на Label + /// + /// + /// + private void labelObject_MouseDown(object sender, MouseEventArgs e) + { + (sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy); + } + + /// + /// Проверка получаемой информации (ее типа на соответствие требуемому) + /// + /// + /// + private void panelObject_DragEnter(object sender, DragEventArgs e) + { + if (e.Data?.GetDataPresent(DataFormats.Text) ?? false) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } + + /// + /// Действия при приеме перетаскиваемой информации + /// + /// + /// + private void panelObject_DragDrop(object sender, DragEventArgs e) + { + switch (e.Data?.GetData(DataFormats.Text).ToString()) + { + case "labelSimpleObject": + _bus = new DrawingBus((int)numericUpDownSpeed.Value, + (int)numericUpDownWeight.Value, + Color.White, + 900, + 500); + break; + case "labelModifiedObject": + _bus = new DrawingAccordionBus((int)numericUpDownSpeed.Value, + (int)numericUpDownWeight.Value, + Color.White, + Color.Black, + checkBoxAdditionalBody.Checked, + checkBoxAdditionalDoor.Checked, + 900, + 500); + break; + } + DrawBus(); + } + + /// + /// Передаем информацию при нажатии на Panel + /// + /// + /// + private void panelColor_MouseDown(object sender, MouseEventArgs e) + { + (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy); + } + + /// + /// Проверка получаемой информации (ее типа на соответствие требуемому) + /// + /// + /// + private void labelColor_DragEnter(object sender, DragEventArgs e) + { + if (e.Data?.GetDataPresent(typeof(Color)) ?? false) + { + e.Effect = DragDropEffects.Copy; + } + else + { + e.Effect = DragDropEffects.None; + } + } + + /// + /// Получение основного цвета + /// + /// + /// + private void labelBodyColor_DragDrop(object sender, DragEventArgs e) + { + if (_bus is DrawingBus bus) + { + labelBodyColor.BackColor = (Color)e.Data.GetData(typeof(Color)); + bus.SetBodyColor((Color)e.Data.GetData(typeof(Color))); + } + DrawBus(); + } + + /// + /// Получение дополнительного цвета + /// + /// + /// + private void labelAdditionalColor_DragDrop(object sender, DragEventArgs e) + { + if (_bus is DrawingAccordionBus bus) + { + labelAdditionalColor.BackColor = (Color)e.Data.GetData(typeof(Color)); + bus.SetAdditionalColor((Color)e.Data.GetData(typeof(Color))); + } + DrawBus(); + } + + /// + /// Добавление автобуса + /// + /// + /// + private void buttonAdd_Click(object sender, EventArgs e) + { + EventAddBus?.Invoke(_bus); + Close(); + } + } +} diff --git a/AccordionBus/AccordionBus/BusConfigForm.resx b/AccordionBus/AccordionBus/BusConfigForm.resx new file mode 100644 index 0000000..a395bff --- /dev/null +++ b/AccordionBus/AccordionBus/BusConfigForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/AccordionBus/AccordionBus/BusDelegate.cs b/AccordionBus/AccordionBus/BusDelegate.cs new file mode 100644 index 0000000..ade764e --- /dev/null +++ b/AccordionBus/AccordionBus/BusDelegate.cs @@ -0,0 +1,15 @@ +using AccordionBus.Drawings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AccordionBus +{ + /// + /// Делегат для передачи объекта-автобуса + /// + /// Объект-автобус + public delegate void BusDelegate(DrawingBus bus); +} diff --git a/AccordionBus/AccordionBus/DrawingAccordionBus.cs b/AccordionBus/AccordionBus/DrawingAccordionBus.cs index 21a59a4..6149858 100644 --- a/AccordionBus/AccordionBus/DrawingAccordionBus.cs +++ b/AccordionBus/AccordionBus/DrawingAccordionBus.cs @@ -32,6 +32,18 @@ namespace AccordionBus.Drawings } } + /// + /// Смена дополнительного цвета + /// + /// Дополнительный цвет + public void SetAdditionalColor(Color additionalColor) + { + if (EntityBus is EntityAccordionBus accordionBus) + { + accordionBus.SetAdditionalColor(additionalColor); + } + } + /// /// Прорисовка объекта /// diff --git a/AccordionBus/AccordionBus/DrawingBus.cs b/AccordionBus/AccordionBus/DrawingBus.cs index d17cf17..8d1087c 100644 --- a/AccordionBus/AccordionBus/DrawingBus.cs +++ b/AccordionBus/AccordionBus/DrawingBus.cs @@ -99,6 +99,15 @@ namespace AccordionBus.Drawings }; } + /// + /// Смена основного цвета + /// + /// Основной цвет + public void SetBodyColor(Color bodyColor) + { + EntityBus.SetBodyColor(bodyColor); + } + /// /// Конструктор /// diff --git a/AccordionBus/AccordionBus/EntityAccordionBus.cs b/AccordionBus/AccordionBus/EntityAccordionBus.cs index f6b83af..08f0907 100644 --- a/AccordionBus/AccordionBus/EntityAccordionBus.cs +++ b/AccordionBus/AccordionBus/EntityAccordionBus.cs @@ -26,6 +26,15 @@ namespace AccordionBus.Entities /// public bool AdditionalDoor { get; private set; } + /// + /// Смена дополнительного цвета + /// + /// Дополнительный цвет + public void SetAdditionalColor(Color additionalColor) + { + AdditionalColor = additionalColor; + } + /// /// Конструктор с параметрами /// diff --git a/AccordionBus/AccordionBus/EntityBus.cs b/AccordionBus/AccordionBus/EntityBus.cs index 7c68641..89577a4 100644 --- a/AccordionBus/AccordionBus/EntityBus.cs +++ b/AccordionBus/AccordionBus/EntityBus.cs @@ -31,6 +31,15 @@ namespace AccordionBus.Entities /// public double Step => (double)Speed * 100 / Weight; + /// + /// Смена основного цвета + /// + /// Основной цвет + public void SetBodyColor(Color bodyColor) + { + BodyColor = bodyColor; + } + /// /// Конструктор с параметрами ///