PIbd-21_MasenkinMS_LabWork05

This commit is contained in:
parent faa713ee33
commit e3a0583302
9 changed files with 751 additions and 9 deletions

View File

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

View File

@ -0,0 +1,369 @@
namespace AccordionBus
{
partial class BusConfigForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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
{
/// <summary>
/// Переменная-выбранный автобус
/// </summary>
DrawingBus? _bus = null;
/// <summary>
/// Событие
/// </summary>
private event Action<DrawingBus> EventAddBus;
/// <summary>
/// Конструктор
/// </summary>
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();
}
/// <summary>
/// Отрисовать автобус
/// </summary>
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;
}
/// <summary>
/// Добавление события
/// </summary>
/// <param name="ev">Событие</param>
public void AddEvent(Action<DrawingBus> ev)
{
if (EventAddBus == null)
{
EventAddBus = ev;
}
else
{
EventAddBus += ev;
}
}
/// <summary>
/// Передаем информацию при нажатии на Label
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void labelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
}
/// <summary>
/// Проверка получаемой информации (ее типа на соответствие требуемому)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void panelObject_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
/// <summary>
/// Действия при приеме перетаскиваемой информации
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Передаем информацию при нажатии на Panel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void panelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
/// <summary>
/// Проверка получаемой информации (ее типа на соответствие требуемому)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void labelColor_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
/// <summary>
/// Получение основного цвета
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Получение дополнительного цвета
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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();
}
/// <summary>
/// Добавление автобуса
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAdd_Click(object sender, EventArgs e)
{
EventAddBus?.Invoke(_bus);
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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
{
/// <summary>
/// Делегат для передачи объекта-автобуса
/// </summary>
/// <param name="bus">Объект-автобус</param>
public delegate void BusDelegate(DrawingBus bus);
}

View File

@ -32,6 +32,18 @@ namespace AccordionBus.Drawings
}
}
/// <summary>
/// Смена дополнительного цвета
/// </summary>
/// <param name="additionalColor">Дополнительный цвет</param>
public void SetAdditionalColor(Color additionalColor)
{
if (EntityBus is EntityAccordionBus accordionBus)
{
accordionBus.SetAdditionalColor(additionalColor);
}
}
/// <summary>
/// Прорисовка объекта
/// </summary>

View File

@ -99,6 +99,15 @@ namespace AccordionBus.Drawings
};
}
/// <summary>
/// Смена основного цвета
/// </summary>
/// <param name="bodyColor">Основной цвет</param>
public void SetBodyColor(Color bodyColor)
{
EntityBus.SetBodyColor(bodyColor);
}
/// <summary>
/// Конструктор
/// </summary>

View File

@ -26,6 +26,15 @@ namespace AccordionBus.Entities
/// </summary>
public bool AdditionalDoor { get; private set; }
/// <summary>
/// Смена дополнительного цвета
/// </summary>
/// <param name="additionalColor">Дополнительный цвет</param>
public void SetAdditionalColor(Color additionalColor)
{
AdditionalColor = additionalColor;
}
/// <summary>
/// Конструктор с параметрами
/// </summary>

View File

@ -31,6 +31,15 @@ namespace AccordionBus.Entities
/// </summary>
public double Step => (double)Speed * 100 / Weight;
/// <summary>
/// Смена основного цвета
/// </summary>
/// <param name="bodyColor">Основной цвет</param>
public void SetBodyColor(Color bodyColor)
{
BodyColor = bodyColor;
}
/// <summary>
/// Конструктор с параметрами
/// </summary>