завершение проекта
This commit is contained in:
parent
3600069b20
commit
7beae4d50f
@ -1,15 +1,18 @@
|
|||||||
using WarmlyLocomotive.Entities;
|
using WarmlyLocomotive.Entities;
|
||||||
|
using WarmlyLocomotive.MovementStrategy;
|
||||||
|
|
||||||
namespace WarmlyLocomotive.DrawningObjects
|
namespace WarmlyLocomotive.DrawningObjects
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawningWarmlyLocomotive
|
public class DrawningWarmlyLocomotive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Класс-сущность
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityWarmlyLocomotive? EntityWarmlyLocomotive { get; protected set; }
|
public EntityWarmlyLocomotive? EntityWarmlyLocomotive { get; protected set; }
|
||||||
|
public IMoveableObject GetMoveableObject => new DrawningObjectCar(this);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -151,6 +154,10 @@ namespace WarmlyLocomotive.DrawningObjects
|
|||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="g"></param>
|
||||||
public virtual void DrawTransport(Graphics g)
|
public virtual void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityWarmlyLocomotive == null)
|
if (EntityWarmlyLocomotive == null)
|
||||||
@ -184,3 +191,4 @@ namespace WarmlyLocomotive.DrawningObjects
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,19 +5,19 @@ namespace WarmlyLocomotive.DrawningObjects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawningPro : DrawningWarmlyLocomotive
|
public class DrawningWarmlyLocomotiveWithTrumpet : DrawningWarmlyLocomotive
|
||||||
{
|
{
|
||||||
public DrawningPro(int speed, double weight, Color bodyColor, Color
|
public DrawningWarmlyLocomotiveWithTrumpet(int speed, double weight, Color bodyColor, Color
|
||||||
additionalColor, bool trumpet, bool luggage, int width, int height) :base(speed, weight, bodyColor, width, height, 200, 75)
|
additionalColor, bool trumpet, bool luggage, int width, int height) :base(speed, weight, bodyColor, width, height, 200, 75)
|
||||||
{
|
{
|
||||||
if (EntityWarmlyLocomotive != null)
|
if (EntityWarmlyLocomotive != null)
|
||||||
{
|
{
|
||||||
EntityWarmlyLocomotive = new Pro(speed, weight, bodyColor, additionalColor, trumpet, luggage);
|
EntityWarmlyLocomotive = new EntityWarmlyLocomotiveWithTrumpet(speed, weight, bodyColor, additionalColor, trumpet, luggage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void DrawTransport(Graphics g)
|
public override void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityWarmlyLocomotive is not Pro warmlylocomotive)
|
if (EntityWarmlyLocomotive is not EntityWarmlyLocomotiveWithTrumpet warmlylocomotive)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
namespace WarmlyLocomotive.Entities
|
namespace WarmlyLocomotive.Entities
|
||||||
{
|
{
|
||||||
public class Pro : EntityWarmlyLocomotive
|
public class EntityWarmlyLocomotiveWithTrumpet : EntityWarmlyLocomotive
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дополнительный цвет (для опциональных элементов)
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
@ -14,7 +14,7 @@
|
|||||||
/// Признак (опция) наличия прицепа
|
/// Признак (опция) наличия прицепа
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Luggage { get; private set; }
|
public bool Luggage { get; private set; }
|
||||||
public Pro(int speed, double weight, Color bodyColor, Color
|
public EntityWarmlyLocomotiveWithTrumpet(int speed, double weight, Color bodyColor, Color
|
||||||
additionalColor, bool trumpet,bool luggage) : base(speed, weight, bodyColor)
|
additionalColor, bool trumpet,bool luggage) : base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
|
|
135
WarmlyLocomotive/FormWarmlyLocomotiveCollection.Designer.cs
generated
Normal file
135
WarmlyLocomotive/FormWarmlyLocomotiveCollection.Designer.cs
generated
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
namespace WarmlyLocomotive
|
||||||
|
{
|
||||||
|
partial class FormWarmlyLocomotiveCollection
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
labelCollection = new Label();
|
||||||
|
panelCollectionWarmlyLocomotive = new Panel();
|
||||||
|
buttonreFreshCollection = new Button();
|
||||||
|
textBoxCollectionWarmlyLocomotive = new TextBox();
|
||||||
|
buttonRemove = new Button();
|
||||||
|
buttonadd = new Button();
|
||||||
|
pictureBoxCollectionWarmlyLocomotive = new PictureBox();
|
||||||
|
panelCollectionWarmlyLocomotive.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollectionWarmlyLocomotive).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelCollection
|
||||||
|
//
|
||||||
|
labelCollection.AutoSize = true;
|
||||||
|
labelCollection.BorderStyle = BorderStyle.Fixed3D;
|
||||||
|
labelCollection.Location = new Point(662, 10);
|
||||||
|
labelCollection.Name = "labelCollection";
|
||||||
|
labelCollection.Size = new Size(85, 17);
|
||||||
|
labelCollection.TabIndex = 0;
|
||||||
|
labelCollection.Text = "Инструменты";
|
||||||
|
//
|
||||||
|
// panelCollectionWarmlyLocomotive
|
||||||
|
//
|
||||||
|
panelCollectionWarmlyLocomotive.Controls.Add(buttonreFreshCollection);
|
||||||
|
panelCollectionWarmlyLocomotive.Controls.Add(textBoxCollectionWarmlyLocomotive);
|
||||||
|
panelCollectionWarmlyLocomotive.Controls.Add(buttonRemove);
|
||||||
|
panelCollectionWarmlyLocomotive.Controls.Add(buttonadd);
|
||||||
|
panelCollectionWarmlyLocomotive.Location = new Point(662, 28);
|
||||||
|
panelCollectionWarmlyLocomotive.Name = "panelCollectionWarmlyLocomotive";
|
||||||
|
panelCollectionWarmlyLocomotive.Size = new Size(149, 350);
|
||||||
|
panelCollectionWarmlyLocomotive.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// buttonreFreshCollection
|
||||||
|
//
|
||||||
|
buttonreFreshCollection.Location = new Point(3, 193);
|
||||||
|
buttonreFreshCollection.Name = "buttonreFreshCollection";
|
||||||
|
buttonreFreshCollection.Size = new Size(146, 23);
|
||||||
|
buttonreFreshCollection.TabIndex = 3;
|
||||||
|
buttonreFreshCollection.Text = "Обновить коллекцию";
|
||||||
|
buttonreFreshCollection.UseVisualStyleBackColor = true;
|
||||||
|
buttonreFreshCollection.Click += buttonreFreshCollection_Click;
|
||||||
|
//
|
||||||
|
// textBoxCollectionWarmlyLocomotive
|
||||||
|
//
|
||||||
|
textBoxCollectionWarmlyLocomotive.Location = new Point(17, 128);
|
||||||
|
textBoxCollectionWarmlyLocomotive.Name = "textBoxCollectionWarmlyLocomotive";
|
||||||
|
textBoxCollectionWarmlyLocomotive.Size = new Size(117, 23);
|
||||||
|
textBoxCollectionWarmlyLocomotive.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// buttonRemove
|
||||||
|
//
|
||||||
|
buttonRemove.Location = new Point(3, 71);
|
||||||
|
buttonRemove.Name = "buttonRemove";
|
||||||
|
buttonRemove.Size = new Size(131, 23);
|
||||||
|
buttonRemove.TabIndex = 1;
|
||||||
|
buttonRemove.Text = "Удалить тепловоз";
|
||||||
|
buttonRemove.UseVisualStyleBackColor = true;
|
||||||
|
buttonRemove.Click += buttonRemove_Click;
|
||||||
|
//
|
||||||
|
// buttonadd
|
||||||
|
//
|
||||||
|
buttonadd.Location = new Point(3, 22);
|
||||||
|
buttonadd.Name = "buttonadd";
|
||||||
|
buttonadd.Size = new Size(131, 23);
|
||||||
|
buttonadd.TabIndex = 0;
|
||||||
|
buttonadd.Text = "Добавить тепловоз";
|
||||||
|
buttonadd.UseVisualStyleBackColor = true;
|
||||||
|
buttonadd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// pictureBoxCollectionWarmlyLocomotive
|
||||||
|
//
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.Location = new Point(12, 28);
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.Name = "pictureBoxCollectionWarmlyLocomotive";
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.Size = new Size(647, 350);
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.TabIndex = 2;
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.TabStop = false;
|
||||||
|
//
|
||||||
|
// FormWarmlyLocomotiveCollection
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(823, 450);
|
||||||
|
Controls.Add(pictureBoxCollectionWarmlyLocomotive);
|
||||||
|
Controls.Add(panelCollectionWarmlyLocomotive);
|
||||||
|
Controls.Add(labelCollection);
|
||||||
|
Name = "FormWarmlyLocomotiveCollection";
|
||||||
|
Text = "FormWarmlyLocomotiveCollection";
|
||||||
|
panelCollectionWarmlyLocomotive.ResumeLayout(false);
|
||||||
|
panelCollectionWarmlyLocomotive.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxCollectionWarmlyLocomotive).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelCollection;
|
||||||
|
private Panel panelCollectionWarmlyLocomotive;
|
||||||
|
private PictureBox pictureBoxCollectionWarmlyLocomotive;
|
||||||
|
private Button buttonadd;
|
||||||
|
private Button buttonRemove;
|
||||||
|
private Button buttonreFreshCollection;
|
||||||
|
private TextBox textBoxCollectionWarmlyLocomotive;
|
||||||
|
}
|
||||||
|
}
|
65
WarmlyLocomotive/FormWarmlyLocomotiveCollection.cs
Normal file
65
WarmlyLocomotive/FormWarmlyLocomotiveCollection.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using WarmlyLocomotive.DrawningObjects;
|
||||||
|
using WarmlyLocomotive.Generics;
|
||||||
|
using WarmlyLocomotive.MovementStrategy;
|
||||||
|
|
||||||
|
namespace WarmlyLocomotive
|
||||||
|
{
|
||||||
|
public partial class FormWarmlyLocomotiveCollection : Form
|
||||||
|
{
|
||||||
|
private readonly CarsGenericCollection<DrawningWarmlyLocomotive,
|
||||||
|
DrawningObjectCar> _warmlylocomotives;
|
||||||
|
public FormWarmlyLocomotiveCollection()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_warmlylocomotives = new CarsGenericCollection<DrawningWarmlyLocomotive, DrawningObjectCar>(pictureBoxCollectionWarmlyLocomotive.Width, pictureBoxCollectionWarmlyLocomotive.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
WarmlyLocomotiveForm form = new();
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (_warmlylocomotives + form.SelectedCar != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект добавлен");
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.Image = _warmlylocomotives.ShowCars();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonreFreshCollection_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.Image = _warmlylocomotives.ShowCars();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonRemove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int pos;
|
||||||
|
if (textBoxCollectionWarmlyLocomotive.Text == null || !int.TryParse(textBoxCollectionWarmlyLocomotive.Text, out pos))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Введите номер парковочного места");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_warmlylocomotives - pos != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Объект удален");
|
||||||
|
pictureBoxCollectionWarmlyLocomotive.Image = _warmlylocomotives.ShowCars();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
WarmlyLocomotive/FormWarmlyLocomotiveCollection.resx
Normal file
120
WarmlyLocomotive/FormWarmlyLocomotiveCollection.resx
Normal 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>
|
@ -11,6 +11,7 @@ namespace WarmlyLocomotive
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
|
Application.Run(new FormWarmlyLocomotiveCollection());
|
||||||
Application.Run(new WarmlyLocomotiveForm());
|
Application.Run(new WarmlyLocomotiveForm());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,13 @@ namespace WarmlyLocomotive
|
|||||||
private DrawningWarmlyLocomotive? _drawningWarmlyLocomotive;
|
private DrawningWarmlyLocomotive? _drawningWarmlyLocomotive;
|
||||||
|
|
||||||
private AbstractStrategy? _abstractStrategy;
|
private AbstractStrategy? _abstractStrategy;
|
||||||
|
private AbstractStrategy? _strategy;
|
||||||
public DrawningWarmlyLocomotive? SelectedCar { get; private set; }
|
public DrawningWarmlyLocomotive? SelectedCar { get; private set; }
|
||||||
public WarmlyLocomotiveForm()
|
public WarmlyLocomotiveForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_strategy = null;
|
||||||
|
SelectedCar = null;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ìåòîä ïðîðèñîâêè ìàøèíû
|
/// Ìåòîä ïðîðèñîâêè ìàøèíû
|
||||||
@ -43,10 +45,17 @@ namespace WarmlyLocomotive
|
|||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new();
|
Random random = new();
|
||||||
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
|
||||||
|
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
color = dialog.Color;
|
||||||
|
}
|
||||||
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotive(random.Next(100, 300),
|
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotive(random.Next(100, 300),
|
||||||
random.Next(1000, 3000),
|
random.Next(1000, 3000),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
color,
|
||||||
random.Next(0, 256)),
|
|
||||||
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
||||||
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
_drawningWarmlyLocomotive.SetPosition(random.Next(10, 100), random.Next(10,
|
||||||
100));
|
100));
|
||||||
@ -126,12 +135,22 @@ namespace WarmlyLocomotive
|
|||||||
private void buttonCreate_Pro_Click(object sender, EventArgs e)
|
private void buttonCreate_Pro_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new();
|
Random random = new();
|
||||||
_drawningWarmlyLocomotive = new DrawningPro(random.Next(100, 300),
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog dialog = new();
|
||||||
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
color = dialog.Color;
|
||||||
|
}
|
||||||
|
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
ColorDialog dopDialog = new();
|
||||||
|
if (dopDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
dopColor = dopDialog.Color;
|
||||||
|
}
|
||||||
|
_drawningWarmlyLocomotive = new DrawningWarmlyLocomotiveWithTrumpet(random.Next(100, 300),
|
||||||
random.Next(1000, 3000),
|
random.Next(1000, 3000),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
color,
|
||||||
random.Next(0, 256)),
|
dopColor,
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),
|
|
||||||
random.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)),
|
Convert.ToBoolean(random.Next(0, 2)),
|
||||||
Convert.ToBoolean(random.Next(0, 2)),
|
Convert.ToBoolean(random.Next(0, 2)),
|
||||||
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
pictureBoxWarmlyLocomotive.Width, pictureBoxWarmlyLocomotive.Height);
|
||||||
@ -139,5 +158,11 @@ namespace WarmlyLocomotive
|
|||||||
100));
|
100));
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonSelectCar_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectedCar = _drawningWarmlyLocomotive;
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27
WarmlyLocomotive/WarmlylocomotiveForm.Designer.cs
generated
27
WarmlyLocomotive/WarmlylocomotiveForm.Designer.cs
generated
@ -38,6 +38,7 @@
|
|||||||
comboBoxWarmlyLocomotive = new ComboBox();
|
comboBoxWarmlyLocomotive = new ComboBox();
|
||||||
buttonStep = new Button();
|
buttonStep = new Button();
|
||||||
buttonCreate_Pro = new Button();
|
buttonCreate_Pro = new Button();
|
||||||
|
buttonSelectCar = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxWarmlyLocomotive).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBoxWarmlyLocomotive).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -46,7 +47,7 @@
|
|||||||
pictureBoxWarmlyLocomotive.Dock = DockStyle.Fill;
|
pictureBoxWarmlyLocomotive.Dock = DockStyle.Fill;
|
||||||
pictureBoxWarmlyLocomotive.Location = new Point(0, 0);
|
pictureBoxWarmlyLocomotive.Location = new Point(0, 0);
|
||||||
pictureBoxWarmlyLocomotive.Name = "pictureBoxWarmlyLocomotive";
|
pictureBoxWarmlyLocomotive.Name = "pictureBoxWarmlyLocomotive";
|
||||||
pictureBoxWarmlyLocomotive.Size = new Size(884, 461);
|
pictureBoxWarmlyLocomotive.Size = new Size(884, 481);
|
||||||
pictureBoxWarmlyLocomotive.SizeMode = PictureBoxSizeMode.AutoSize;
|
pictureBoxWarmlyLocomotive.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||||
pictureBoxWarmlyLocomotive.TabIndex = 0;
|
pictureBoxWarmlyLocomotive.TabIndex = 0;
|
||||||
pictureBoxWarmlyLocomotive.TabStop = false;
|
pictureBoxWarmlyLocomotive.TabStop = false;
|
||||||
@ -54,7 +55,7 @@
|
|||||||
// buttonCreate
|
// buttonCreate
|
||||||
//
|
//
|
||||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonCreate.Location = new Point(210, 404);
|
buttonCreate.Location = new Point(216, 399);
|
||||||
buttonCreate.Name = "buttonCreate";
|
buttonCreate.Name = "buttonCreate";
|
||||||
buttonCreate.Size = new Size(119, 23);
|
buttonCreate.Size = new Size(119, 23);
|
||||||
buttonCreate.TabIndex = 1;
|
buttonCreate.TabIndex = 1;
|
||||||
@ -67,7 +68,7 @@
|
|||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonLeft.Location = new Point(751, 400);
|
buttonLeft.Location = new Point(751, 420);
|
||||||
buttonLeft.Name = "buttonLeft";
|
buttonLeft.Name = "buttonLeft";
|
||||||
buttonLeft.Size = new Size(30, 30);
|
buttonLeft.Size = new Size(30, 30);
|
||||||
buttonLeft.TabIndex = 2;
|
buttonLeft.TabIndex = 2;
|
||||||
@ -79,7 +80,7 @@
|
|||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonUp.Location = new Point(777, 372);
|
buttonUp.Location = new Point(777, 392);
|
||||||
buttonUp.Name = "buttonUp";
|
buttonUp.Name = "buttonUp";
|
||||||
buttonUp.Size = new Size(30, 30);
|
buttonUp.Size = new Size(30, 30);
|
||||||
buttonUp.TabIndex = 3;
|
buttonUp.TabIndex = 3;
|
||||||
@ -91,7 +92,7 @@
|
|||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonDown.Location = new Point(777, 400);
|
buttonDown.Location = new Point(777, 420);
|
||||||
buttonDown.Name = "buttonDown";
|
buttonDown.Name = "buttonDown";
|
||||||
buttonDown.Size = new Size(30, 30);
|
buttonDown.Size = new Size(30, 30);
|
||||||
buttonDown.TabIndex = 4;
|
buttonDown.TabIndex = 4;
|
||||||
@ -103,7 +104,7 @@
|
|||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||||
buttonRight.Location = new Point(808, 400);
|
buttonRight.Location = new Point(808, 420);
|
||||||
buttonRight.Name = "buttonRight";
|
buttonRight.Name = "buttonRight";
|
||||||
buttonRight.Size = new Size(30, 30);
|
buttonRight.Size = new Size(30, 30);
|
||||||
buttonRight.TabIndex = 5;
|
buttonRight.TabIndex = 5;
|
||||||
@ -140,9 +141,20 @@
|
|||||||
buttonCreate_Pro.UseVisualStyleBackColor = true;
|
buttonCreate_Pro.UseVisualStyleBackColor = true;
|
||||||
buttonCreate_Pro.Click += buttonCreate_Pro_Click;
|
buttonCreate_Pro.Click += buttonCreate_Pro_Click;
|
||||||
//
|
//
|
||||||
|
// buttonSelectCar
|
||||||
|
//
|
||||||
|
buttonSelectCar.Location = new Point(705, 99);
|
||||||
|
buttonSelectCar.Name = "buttonSelectCar";
|
||||||
|
buttonSelectCar.Size = new Size(133, 23);
|
||||||
|
buttonSelectCar.TabIndex = 11;
|
||||||
|
buttonSelectCar.Text = "Выбор тепловоза";
|
||||||
|
buttonSelectCar.UseVisualStyleBackColor = true;
|
||||||
|
buttonSelectCar.Click += buttonSelectCar_Click;
|
||||||
|
//
|
||||||
// WarmlyLocomotiveForm
|
// WarmlyLocomotiveForm
|
||||||
//
|
//
|
||||||
ClientSize = new Size(884, 461);
|
ClientSize = new Size(884, 481);
|
||||||
|
Controls.Add(buttonSelectCar);
|
||||||
Controls.Add(buttonCreate_Pro);
|
Controls.Add(buttonCreate_Pro);
|
||||||
Controls.Add(buttonStep);
|
Controls.Add(buttonStep);
|
||||||
Controls.Add(comboBoxWarmlyLocomotive);
|
Controls.Add(comboBoxWarmlyLocomotive);
|
||||||
@ -173,5 +185,6 @@
|
|||||||
private ComboBox comboBoxWarmlyLocomotive;
|
private ComboBox comboBoxWarmlyLocomotive;
|
||||||
private Button buttonStep;
|
private Button buttonStep;
|
||||||
private Button buttonCreate_Pro;
|
private Button buttonCreate_Pro;
|
||||||
|
private Button buttonSelectCar;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user