Lab03 Готовая
This commit is contained in:
parent
1c816e6597
commit
73b879b9c6
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows7.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
@ -8,7 +8,7 @@ using AirBomber.Drawnings;
|
|||||||
namespace AirBomber.CollectionGenericObjects;
|
namespace AirBomber.CollectionGenericObjects;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Абстракция компании, хранящий коллекцию самолеток
|
/// Абстракция компании, хранящий коллекцию самолетов
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class AbstractCompany
|
public abstract class AbstractCompany
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ public abstract class AbstractCompany
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Размер места (высота)
|
/// Размер места (высота)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int _placeSizeHeight = 80;
|
protected readonly int _placeSizeHeight = 150;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
@ -33,7 +33,7 @@ public abstract class AbstractCompany
|
|||||||
protected readonly int _pictureHeight;
|
protected readonly int _pictureHeight;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Коллекция самолетов
|
/// Коллекция лодок
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected ICollectionGenericObjects<DrawningAirPlane>? _collection = null;
|
protected ICollectionGenericObjects<DrawningAirPlane>? _collection = null;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ public abstract class AbstractCompany
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="picWidth">Ширина окна</param>
|
/// <param name="picWidth">Ширина окна</param>
|
||||||
/// <param name="picHeight">Высота окна</param>
|
/// <param name="picHeight">Высота окна</param>
|
||||||
/// <param name="collection">Коллекция самолетов</param>
|
/// <param name="collection">Коллекция лодок</param>
|
||||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningAirPlane> collection)
|
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningAirPlane> collection)
|
||||||
{
|
{
|
||||||
_pictureWidth = picWidth;
|
_pictureWidth = picWidth;
|
||||||
@ -60,11 +60,11 @@ public abstract class AbstractCompany
|
|||||||
/// Перегрузка оператора сложения для класса
|
/// Перегрузка оператора сложения для класса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="company">Компания</param>
|
/// <param name="company">Компания</param>
|
||||||
/// <param name="airplane">Добавляемый объект</param>
|
/// <param name="boat">Добавляемый объект</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int operator +(AbstractCompany company, DrawningAirPlane airplane)
|
public static int operator +(AbstractCompany company, DrawningAirPlane boat)
|
||||||
{
|
{
|
||||||
return company._collection?.Insert(airplane) ?? -1;
|
return company._collection?.Insert(boat) ?? -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,30 +23,32 @@ public class AirPlaneSharingService : AbstractCompany
|
|||||||
|
|
||||||
protected override void DrawBackground(Graphics g)
|
protected override void DrawBackground(Graphics g)
|
||||||
{
|
{
|
||||||
Color backgroundColor = Color.SkyBlue;
|
Color backgroundColor = Color.Gray;
|
||||||
using (Brush brush = new SolidBrush(backgroundColor))
|
using (Brush brush = new SolidBrush(backgroundColor))
|
||||||
{
|
{
|
||||||
g.FillRectangle(brush, new Rectangle(0, 0, _pictureWidth, _pictureHeight));
|
g.FillRectangle(brush, new Rectangle(0, 0, _pictureWidth, _pictureHeight));
|
||||||
}
|
}
|
||||||
Pen pen = new Pen(Color.Brown, 3);
|
Pen pen = new Pen(Color.Brown, 3);
|
||||||
int offsetX = 10, offsetY = -12;
|
int offsetX = 10, offsetY = -12;
|
||||||
int x = 1 + offsetX, y = _pictureHeight - _placeSizeHeight + offsetY;
|
int x = _pictureWidth - _placeSizeWidth, y = offsetY;
|
||||||
numRows = 0;
|
numRows = 0;
|
||||||
while (y >= 0)
|
while (y + _placeSizeHeight <= _pictureHeight)
|
||||||
{
|
{
|
||||||
int numCols = 0;
|
int numCols = 0;
|
||||||
while (x + _placeSizeWidth <= _pictureWidth)
|
int initialX = x; // сохраняем начальное значение x
|
||||||
|
while (x >= 0)
|
||||||
{
|
{
|
||||||
numCols++;
|
numCols++;
|
||||||
g.DrawLine(pen, x, y, x + _placeSizeWidth / 2, y);
|
g.DrawLine(pen, x, y, x + _placeSizeWidth / 2, y);
|
||||||
g.DrawLine(pen, x, y, x, y + _placeSizeHeight + 4);
|
g.DrawLine(pen, x, y, x, y + _placeSizeHeight + 4);
|
||||||
locCoord.Add(new Tuple<int, int>(x, y));
|
locCoord.Add(new Tuple<int, int>(x, y));
|
||||||
x += _placeSizeWidth + 2;
|
x -= _placeSizeWidth + 2;
|
||||||
}
|
}
|
||||||
numRows++;
|
numRows++;
|
||||||
x = 1 + offsetX;
|
x = initialX; // возвращаем x к начальному значению после завершения строки
|
||||||
y -= _placeSizeHeight + 5 + offsetY;
|
y += _placeSizeHeight + 5 + offsetY;
|
||||||
}
|
}
|
||||||
|
numCols = numCols; // сохраняем значение numCols для использования в других методах
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetObjectsPosition()
|
protected override void SetObjectsPosition()
|
||||||
|
202
AirBomber/FormAirBomber.Designer.cs
generated
202
AirBomber/FormAirBomber.Designer.cs
generated
@ -28,151 +28,127 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.buttonCreateAirPlane = new System.Windows.Forms.Button();
|
ButtonRight = new Button();
|
||||||
this.ButtonRight = new System.Windows.Forms.Button();
|
ButtonUp = new Button();
|
||||||
this.ButtonUp = new System.Windows.Forms.Button();
|
ButtonLeft = new Button();
|
||||||
this.ButtonLeft = new System.Windows.Forms.Button();
|
ButtonDown = new Button();
|
||||||
this.ButtonDown = new System.Windows.Forms.Button();
|
pictureBoxAirBomber = new PictureBox();
|
||||||
this.pictureBoxAirBomber = new System.Windows.Forms.PictureBox();
|
comboBoxStrategy = new ComboBox();
|
||||||
this.buttonCreateAirBomber = new System.Windows.Forms.Button();
|
buttonStrategyStep = new Button();
|
||||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
((System.ComponentModel.ISupportInitialize)pictureBoxAirBomber).BeginInit();
|
||||||
this.buttonStrategyStep = new System.Windows.Forms.Button();
|
SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// buttonCreateAirPlane
|
|
||||||
//
|
|
||||||
this.buttonCreateAirPlane.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreateAirPlane.Location = new System.Drawing.Point(12, 575);
|
|
||||||
this.buttonCreateAirPlane.Name = "buttonCreateAirPlane";
|
|
||||||
this.buttonCreateAirPlane.Size = new System.Drawing.Size(233, 33);
|
|
||||||
this.buttonCreateAirPlane.TabIndex = 0;
|
|
||||||
this.buttonCreateAirPlane.Text = "Создать Военный самолет";
|
|
||||||
this.buttonCreateAirPlane.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreateAirPlane.Click += new System.EventHandler(this.ButtonCreateAirPlane_Click);
|
|
||||||
//
|
//
|
||||||
// ButtonRight
|
// ButtonRight
|
||||||
//
|
//
|
||||||
this.ButtonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
this.ButtonRight.BackgroundImage = global::AirBomber.Properties.Resources.arrowRight;
|
ButtonRight.BackgroundImage = Properties.Resources.arrowRight;
|
||||||
this.ButtonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
ButtonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
this.ButtonRight.Location = new System.Drawing.Point(905, 560);
|
ButtonRight.Location = new Point(792, 420);
|
||||||
this.ButtonRight.Name = "ButtonRight";
|
ButtonRight.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.ButtonRight.Size = new System.Drawing.Size(50, 48);
|
ButtonRight.Name = "ButtonRight";
|
||||||
this.ButtonRight.TabIndex = 1;
|
ButtonRight.Size = new Size(44, 36);
|
||||||
this.ButtonRight.UseVisualStyleBackColor = true;
|
ButtonRight.TabIndex = 1;
|
||||||
this.ButtonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
ButtonRight.UseVisualStyleBackColor = true;
|
||||||
|
ButtonRight.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// ButtonUp
|
// ButtonUp
|
||||||
//
|
//
|
||||||
this.ButtonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
this.ButtonUp.BackgroundImage = global::AirBomber.Properties.Resources.arrowUp;
|
ButtonUp.BackgroundImage = Properties.Resources.arrowUp;
|
||||||
this.ButtonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
ButtonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
this.ButtonUp.Location = new System.Drawing.Point(849, 506);
|
ButtonUp.Location = new Point(743, 380);
|
||||||
this.ButtonUp.Name = "ButtonUp";
|
ButtonUp.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.ButtonUp.Size = new System.Drawing.Size(50, 48);
|
ButtonUp.Name = "ButtonUp";
|
||||||
this.ButtonUp.TabIndex = 2;
|
ButtonUp.Size = new Size(44, 36);
|
||||||
this.ButtonUp.UseVisualStyleBackColor = true;
|
ButtonUp.TabIndex = 2;
|
||||||
this.ButtonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
ButtonUp.UseVisualStyleBackColor = true;
|
||||||
|
ButtonUp.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// ButtonLeft
|
// ButtonLeft
|
||||||
//
|
//
|
||||||
this.ButtonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
this.ButtonLeft.BackgroundImage = global::AirBomber.Properties.Resources.arrowLeft;
|
ButtonLeft.BackgroundImage = Properties.Resources.arrowLeft;
|
||||||
this.ButtonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
ButtonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
this.ButtonLeft.Location = new System.Drawing.Point(793, 560);
|
ButtonLeft.Location = new Point(694, 420);
|
||||||
this.ButtonLeft.Name = "ButtonLeft";
|
ButtonLeft.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.ButtonLeft.Size = new System.Drawing.Size(50, 48);
|
ButtonLeft.Name = "ButtonLeft";
|
||||||
this.ButtonLeft.TabIndex = 3;
|
ButtonLeft.Size = new Size(44, 36);
|
||||||
this.ButtonLeft.UseVisualStyleBackColor = true;
|
ButtonLeft.TabIndex = 3;
|
||||||
this.ButtonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
ButtonLeft.UseVisualStyleBackColor = true;
|
||||||
|
ButtonLeft.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// ButtonDown
|
// ButtonDown
|
||||||
//
|
//
|
||||||
this.ButtonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
ButtonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
this.ButtonDown.BackgroundImage = global::AirBomber.Properties.Resources.arrowDown;
|
ButtonDown.BackgroundImage = Properties.Resources.arrowDown;
|
||||||
this.ButtonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
ButtonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
this.ButtonDown.Location = new System.Drawing.Point(849, 560);
|
ButtonDown.Location = new Point(743, 420);
|
||||||
this.ButtonDown.Name = "ButtonDown";
|
ButtonDown.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.ButtonDown.Size = new System.Drawing.Size(50, 48);
|
ButtonDown.Name = "ButtonDown";
|
||||||
this.ButtonDown.TabIndex = 4;
|
ButtonDown.Size = new Size(44, 36);
|
||||||
this.ButtonDown.UseVisualStyleBackColor = true;
|
ButtonDown.TabIndex = 4;
|
||||||
this.ButtonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
ButtonDown.UseVisualStyleBackColor = true;
|
||||||
|
ButtonDown.Click += ButtonMove_Click;
|
||||||
//
|
//
|
||||||
// pictureBoxAirBomber
|
// pictureBoxAirBomber
|
||||||
//
|
//
|
||||||
this.pictureBoxAirBomber.Dock = System.Windows.Forms.DockStyle.Fill;
|
pictureBoxAirBomber.Dock = DockStyle.Fill;
|
||||||
this.pictureBoxAirBomber.Location = new System.Drawing.Point(0, 0);
|
pictureBoxAirBomber.Location = new Point(0, 0);
|
||||||
this.pictureBoxAirBomber.Name = "pictureBoxAirBomber";
|
pictureBoxAirBomber.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.pictureBoxAirBomber.Size = new System.Drawing.Size(967, 621);
|
pictureBoxAirBomber.Name = "pictureBoxAirBomber";
|
||||||
this.pictureBoxAirBomber.TabIndex = 5;
|
pictureBoxAirBomber.Size = new Size(846, 466);
|
||||||
this.pictureBoxAirBomber.TabStop = false;
|
pictureBoxAirBomber.TabIndex = 5;
|
||||||
//
|
pictureBoxAirBomber.TabStop = false;
|
||||||
// buttonCreateAirBomber
|
|
||||||
//
|
|
||||||
this.buttonCreateAirBomber.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreateAirBomber.Location = new System.Drawing.Point(283, 576);
|
|
||||||
this.buttonCreateAirBomber.Name = "buttonCreateAirBomber";
|
|
||||||
this.buttonCreateAirBomber.Size = new System.Drawing.Size(220, 33);
|
|
||||||
this.buttonCreateAirBomber.TabIndex = 6;
|
|
||||||
this.buttonCreateAirBomber.Text = "Создать Бомбардировщик";
|
|
||||||
this.buttonCreateAirBomber.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreateAirBomber.Click += new System.EventHandler(this.ButtonCreateAirBomber_Click);
|
|
||||||
//
|
//
|
||||||
// comboBoxStrategy
|
// comboBoxStrategy
|
||||||
//
|
//
|
||||||
this.comboBoxStrategy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxStrategy.FormattingEnabled = true;
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
this.comboBoxStrategy.Items.AddRange(new object[] {
|
comboBoxStrategy.Items.AddRange(new object[] { "К центру ", "К краю" });
|
||||||
"К центру ",
|
comboBoxStrategy.Location = new Point(704, 9);
|
||||||
"К краю"});
|
comboBoxStrategy.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.comboBoxStrategy.Location = new System.Drawing.Point(804, 12);
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
comboBoxStrategy.Size = new Size(133, 23);
|
||||||
this.comboBoxStrategy.Size = new System.Drawing.Size(151, 28);
|
comboBoxStrategy.TabIndex = 7;
|
||||||
this.comboBoxStrategy.TabIndex = 7;
|
|
||||||
//
|
//
|
||||||
// buttonStrategyStep
|
// buttonStrategyStep
|
||||||
//
|
//
|
||||||
this.buttonStrategyStep.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
buttonStrategyStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
this.buttonStrategyStep.Location = new System.Drawing.Point(804, 74);
|
buttonStrategyStep.Location = new Point(704, 56);
|
||||||
this.buttonStrategyStep.Name = "buttonStrategyStep";
|
buttonStrategyStep.Margin = new Padding(3, 2, 3, 2);
|
||||||
this.buttonStrategyStep.Size = new System.Drawing.Size(94, 29);
|
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||||
this.buttonStrategyStep.TabIndex = 8;
|
buttonStrategyStep.Size = new Size(82, 22);
|
||||||
this.buttonStrategyStep.Text = "Шаг";
|
buttonStrategyStep.TabIndex = 8;
|
||||||
this.buttonStrategyStep.UseVisualStyleBackColor = true;
|
buttonStrategyStep.Text = "Шаг";
|
||||||
this.buttonStrategyStep.Click += new System.EventHandler(this.buttonStrategyStep_Click);
|
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||||
|
buttonStrategyStep.Click += buttonStrategyStep_Click;
|
||||||
//
|
//
|
||||||
// FormAirBomber
|
// FormAirBomber
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(967, 621);
|
ClientSize = new Size(846, 466);
|
||||||
this.Controls.Add(this.buttonStrategyStep);
|
Controls.Add(buttonStrategyStep);
|
||||||
this.Controls.Add(this.comboBoxStrategy);
|
Controls.Add(comboBoxStrategy);
|
||||||
this.Controls.Add(this.buttonCreateAirBomber);
|
Controls.Add(ButtonDown);
|
||||||
this.Controls.Add(this.ButtonDown);
|
Controls.Add(ButtonLeft);
|
||||||
this.Controls.Add(this.ButtonLeft);
|
Controls.Add(ButtonUp);
|
||||||
this.Controls.Add(this.ButtonUp);
|
Controls.Add(ButtonRight);
|
||||||
this.Controls.Add(this.ButtonRight);
|
Controls.Add(pictureBoxAirBomber);
|
||||||
this.Controls.Add(this.buttonCreateAirPlane);
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
this.Controls.Add(this.pictureBoxAirBomber);
|
Name = "FormAirBomber";
|
||||||
this.Name = "FormAirBomber";
|
Text = "AirBomber";
|
||||||
this.Text = "AirBomber";
|
((System.ComponentModel.ISupportInitialize)pictureBoxAirBomber).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirBomber)).EndInit();
|
ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Button buttonCreateAirPlane;
|
|
||||||
private Button ButtonRight;
|
private Button ButtonRight;
|
||||||
private Button ButtonUp;
|
private Button ButtonUp;
|
||||||
private Button ButtonLeft;
|
private Button ButtonLeft;
|
||||||
private Button ButtonDown;
|
private Button ButtonDown;
|
||||||
private PictureBox pictureBoxAirBomber;
|
private PictureBox pictureBoxAirBomber;
|
||||||
private Button buttonCreateAirBomber;
|
|
||||||
private ComboBox comboBoxStrategy;
|
private ComboBox comboBoxStrategy;
|
||||||
private Button buttonStrategyStep;
|
private Button buttonStrategyStep;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,22 @@ public partial class FormAirBomber : Form
|
|||||||
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
/// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private DrawningAirPlane? _drawningAirPlane;
|
private DrawningAirPlane? _drawningAirPlane;
|
||||||
|
/// <summary>
|
||||||
|
/// Ñòðàòåãèÿ ïåðåìåùåíèÿ
|
||||||
|
/// </summary>
|
||||||
private AbstractStrategy? _strategy;
|
private AbstractStrategy? _strategy;
|
||||||
|
|
||||||
|
public DrawningAirPlane SetAirPlane
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_drawningAirPlane = value;
|
||||||
|
_drawningAirPlane.SetPictureSize(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
|
||||||
|
comboBoxStrategy.Enabled = true;
|
||||||
|
_strategy = null;
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
public FormAirBomber()
|
public FormAirBomber()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -38,52 +52,6 @@ public partial class FormAirBomber : Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ñîçäàíèå îáúåêòà
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
private void CreateObject(string type)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case nameof(DrawningAirPlane):
|
|
||||||
_drawningAirPlane = new DrawningAirPlane(random.Next(30, 100), random.Next(100, 500),
|
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
|
||||||
break;
|
|
||||||
case nameof(DrawningAirBomber):
|
|
||||||
_drawningAirPlane = new DrawningAirBomber(random.Next(30, 100), random.Next(100, 500),
|
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
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)));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
_drawningAirPlane.SetPictureSize(pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
|
|
||||||
_drawningAirPlane.SetPosition(random.Next(15, 100), random.Next(15, 100));
|
|
||||||
_strategy = null;
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü áîìáàðäèðîâùèê"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonCreateAirBomber_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirBomber));
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü âîåííûé ñàìîëåò"
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void ButtonCreateAirPlane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirPlane));
|
|
||||||
|
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_drawningAirPlane == null)
|
if (_drawningAirPlane == null)
|
||||||
|
@ -1,4 +1,64 @@
|
|||||||
<root>
|
<?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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
158
AirBomber/FormAirPlaneCollection.Designer.cs
generated
158
AirBomber/FormAirPlaneCollection.Designer.cs
generated
@ -1,5 +1,5 @@
|
|||||||
namespace AirBomber;
|
namespace AirBomber
|
||||||
|
{
|
||||||
partial class FormAirPlaneCollection
|
partial class FormAirPlaneCollection
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -29,14 +29,14 @@ partial class FormAirPlaneCollection
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
groupBoxTools = new GroupBox();
|
groupBoxTools = new GroupBox();
|
||||||
comboBoxSelectorCompany = new ComboBox();
|
|
||||||
buttonAddAirPlane = new Button();
|
|
||||||
buttonAddAirBomber = new Button();
|
|
||||||
pictureBox = new PictureBox();
|
|
||||||
maskedTextBox = new MaskedTextBox();
|
|
||||||
buttonDelAirPlane = new Button();
|
|
||||||
buttonGoToCheck = new Button();
|
|
||||||
buttonRefresh = new Button();
|
buttonRefresh = new Button();
|
||||||
|
buttonGoToCheck = new Button();
|
||||||
|
buttonDelAirPlane = new Button();
|
||||||
|
maskedTextBox = new MaskedTextBox();
|
||||||
|
buttonAddAirBomber = new Button();
|
||||||
|
buttonAddAirPlane = new Button();
|
||||||
|
comboBoxSelectorCompany = new ComboBox();
|
||||||
|
pictureBox = new PictureBox();
|
||||||
groupBoxTools.SuspendLayout();
|
groupBoxTools.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -51,12 +51,74 @@ partial class FormAirPlaneCollection
|
|||||||
groupBoxTools.Controls.Add(buttonAddAirPlane);
|
groupBoxTools.Controls.Add(buttonAddAirPlane);
|
||||||
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
|
||||||
groupBoxTools.Dock = DockStyle.Right;
|
groupBoxTools.Dock = DockStyle.Right;
|
||||||
groupBoxTools.Location = new Point(784, 0);
|
groupBoxTools.Location = new Point(793, 0);
|
||||||
groupBoxTools.Name = "groupBoxTools";
|
groupBoxTools.Name = "groupBoxTools";
|
||||||
groupBoxTools.Size = new Size(214, 650);
|
groupBoxTools.Size = new Size(167, 644);
|
||||||
groupBoxTools.TabIndex = 0;
|
groupBoxTools.TabIndex = 0;
|
||||||
groupBoxTools.TabStop = false;
|
groupBoxTools.TabStop = false;
|
||||||
groupBoxTools.Text = "Инструменты";
|
groupBoxTools.Text = "Инструманты";
|
||||||
|
//
|
||||||
|
// buttonRefresh
|
||||||
|
//
|
||||||
|
buttonRefresh.Location = new Point(12, 463);
|
||||||
|
buttonRefresh.Name = "buttonRefresh";
|
||||||
|
buttonRefresh.Size = new Size(143, 43);
|
||||||
|
buttonRefresh.TabIndex = 6;
|
||||||
|
buttonRefresh.Text = "Обновить";
|
||||||
|
buttonRefresh.UseVisualStyleBackColor = true;
|
||||||
|
buttonRefresh.Click += ButtonRefresh_Click;
|
||||||
|
//
|
||||||
|
// buttonGoToCheck
|
||||||
|
//
|
||||||
|
buttonGoToCheck.Location = new Point(12, 370);
|
||||||
|
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||||
|
buttonGoToCheck.Size = new Size(143, 41);
|
||||||
|
buttonGoToCheck.TabIndex = 5;
|
||||||
|
buttonGoToCheck.Text = "Передать на тесты";
|
||||||
|
buttonGoToCheck.UseVisualStyleBackColor = true;
|
||||||
|
buttonGoToCheck.Click += ButtonGoToCheck_Click;
|
||||||
|
//
|
||||||
|
// buttonDelAirPlane
|
||||||
|
//
|
||||||
|
buttonDelAirPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
buttonDelAirPlane.Location = new Point(12, 275);
|
||||||
|
buttonDelAirPlane.Name = "buttonDelAirPlane";
|
||||||
|
buttonDelAirPlane.Size = new Size(143, 39);
|
||||||
|
buttonDelAirPlane.TabIndex = 4;
|
||||||
|
buttonDelAirPlane.Text = "Удалить Самолет";
|
||||||
|
buttonDelAirPlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonDelAirPlane.Click += ButtonRemoveAirPlane_Click;
|
||||||
|
//
|
||||||
|
// maskedTextBox
|
||||||
|
//
|
||||||
|
maskedTextBox.Location = new Point(12, 246);
|
||||||
|
maskedTextBox.Mask = "00";
|
||||||
|
maskedTextBox.Name = "maskedTextBox";
|
||||||
|
maskedTextBox.Size = new Size(143, 23);
|
||||||
|
maskedTextBox.TabIndex = 3;
|
||||||
|
maskedTextBox.ValidatingType = typeof(int);
|
||||||
|
//
|
||||||
|
// buttonAddAirBomber
|
||||||
|
//
|
||||||
|
buttonAddAirBomber.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
buttonAddAirBomber.Location = new Point(12, 124);
|
||||||
|
buttonAddAirBomber.Name = "buttonAddAirBomber";
|
||||||
|
buttonAddAirBomber.Size = new Size(143, 42);
|
||||||
|
buttonAddAirBomber.TabIndex = 2;
|
||||||
|
buttonAddAirBomber.Text = "Добавление Бомбардировщика";
|
||||||
|
buttonAddAirBomber.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddAirBomber.Click += buttonAddAirBomber_Click;
|
||||||
|
//
|
||||||
|
// buttonAddAirPlane
|
||||||
|
//
|
||||||
|
buttonAddAirPlane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
buttonAddAirPlane.Location = new Point(12, 77);
|
||||||
|
buttonAddAirPlane.Name = "buttonAddAirPlane";
|
||||||
|
buttonAddAirPlane.Size = new Size(143, 41);
|
||||||
|
buttonAddAirPlane.TabIndex = 1;
|
||||||
|
buttonAddAirPlane.Text = "Добавление самолета";
|
||||||
|
buttonAddAirPlane.UseVisualStyleBackColor = true;
|
||||||
|
buttonAddAirPlane.Click += buttonAddAirPlane_Click;
|
||||||
//
|
//
|
||||||
// comboBoxSelectorCompany
|
// comboBoxSelectorCompany
|
||||||
//
|
//
|
||||||
@ -64,83 +126,30 @@ partial class FormAirPlaneCollection
|
|||||||
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxSelectorCompany.FormattingEnabled = true;
|
comboBoxSelectorCompany.FormattingEnabled = true;
|
||||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||||
comboBoxSelectorCompany.Location = new Point(14, 39);
|
comboBoxSelectorCompany.Location = new Point(12, 31);
|
||||||
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
|
||||||
comboBoxSelectorCompany.Size = new Size(188, 28);
|
comboBoxSelectorCompany.Size = new Size(143, 23);
|
||||||
comboBoxSelectorCompany.TabIndex = 0;
|
comboBoxSelectorCompany.TabIndex = 0;
|
||||||
//
|
comboBoxSelectorCompany.SelectedIndexChanged += comboBoxSelectorCompany_SelectedIndexChanged;
|
||||||
// buttonAddAirPlane
|
|
||||||
//
|
|
||||||
buttonAddAirPlane.Location = new Point(14, 128);
|
|
||||||
buttonAddAirPlane.Name = "buttonAddAirPlane";
|
|
||||||
buttonAddAirPlane.Size = new Size(188, 42);
|
|
||||||
buttonAddAirPlane.TabIndex = 1;
|
|
||||||
buttonAddAirPlane.Text = "Добавление самолета";
|
|
||||||
buttonAddAirPlane.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonAddAirBomber
|
|
||||||
//
|
|
||||||
buttonAddAirBomber.Location = new Point(14, 189);
|
|
||||||
buttonAddAirBomber.Name = "buttonAddAirBomber";
|
|
||||||
buttonAddAirBomber.Size = new Size(188, 50);
|
|
||||||
buttonAddAirBomber.TabIndex = 2;
|
|
||||||
buttonAddAirBomber.Text = "Добавление Бомбардировщика";
|
|
||||||
buttonAddAirBomber.UseVisualStyleBackColor = true;
|
|
||||||
//
|
//
|
||||||
// pictureBox
|
// pictureBox
|
||||||
//
|
//
|
||||||
pictureBox.Dock = DockStyle.Fill;
|
pictureBox.Dock = DockStyle.Fill;
|
||||||
pictureBox.Location = new Point(0, 0);
|
pictureBox.Location = new Point(0, 0);
|
||||||
pictureBox.Name = "pictureBox";
|
pictureBox.Name = "pictureBox";
|
||||||
pictureBox.Size = new Size(784, 650);
|
pictureBox.Size = new Size(793, 644);
|
||||||
pictureBox.TabIndex = 1;
|
pictureBox.TabIndex = 1;
|
||||||
pictureBox.TabStop = false;
|
pictureBox.TabStop = false;
|
||||||
//
|
//
|
||||||
// maskedTextBox
|
|
||||||
//
|
|
||||||
maskedTextBox.Location = new Point(14, 272);
|
|
||||||
maskedTextBox.Mask = "00";
|
|
||||||
maskedTextBox.Name = "maskedTextBox";
|
|
||||||
maskedTextBox.Size = new Size(188, 27);
|
|
||||||
maskedTextBox.TabIndex = 3;
|
|
||||||
maskedTextBox.ValidatingType = typeof(int);
|
|
||||||
//
|
|
||||||
// buttonDelAirPlane
|
|
||||||
//
|
|
||||||
buttonDelAirPlane.Location = new Point(14, 327);
|
|
||||||
buttonDelAirPlane.Name = "buttonDelAirPlane";
|
|
||||||
buttonDelAirPlane.Size = new Size(188, 59);
|
|
||||||
buttonDelAirPlane.TabIndex = 4;
|
|
||||||
buttonDelAirPlane.Text = "Удалить самолет";
|
|
||||||
buttonDelAirPlane.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonGoToCheck
|
|
||||||
//
|
|
||||||
buttonGoToCheck.Location = new Point(14, 443);
|
|
||||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
|
||||||
buttonGoToCheck.Size = new Size(188, 59);
|
|
||||||
buttonGoToCheck.TabIndex = 5;
|
|
||||||
buttonGoToCheck.Text = "Передать на тесты";
|
|
||||||
buttonGoToCheck.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonRefresh
|
|
||||||
//
|
|
||||||
buttonRefresh.Location = new Point(14, 569);
|
|
||||||
buttonRefresh.Name = "buttonRefresh";
|
|
||||||
buttonRefresh.Size = new Size(188, 59);
|
|
||||||
buttonRefresh.TabIndex = 6;
|
|
||||||
buttonRefresh.Text = "Обновить";
|
|
||||||
buttonRefresh.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormAirPlaneCollection
|
// FormAirPlaneCollection
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(998, 650);
|
ClientSize = new Size(960, 644);
|
||||||
Controls.Add(pictureBox);
|
Controls.Add(pictureBox);
|
||||||
Controls.Add(groupBoxTools);
|
Controls.Add(groupBoxTools);
|
||||||
Name = "FormAirPlaneCollection";
|
Name = "FormAirPlaneCollection";
|
||||||
Text = "Коллекция самолетов";
|
Text = "FormAirPlaneCollection";
|
||||||
groupBoxTools.ResumeLayout(false);
|
groupBoxTools.ResumeLayout(false);
|
||||||
groupBoxTools.PerformLayout();
|
groupBoxTools.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
|
||||||
@ -150,12 +159,13 @@ partial class FormAirPlaneCollection
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private GroupBox groupBoxTools;
|
private GroupBox groupBoxTools;
|
||||||
|
private Button buttonAddAirPlane;
|
||||||
private ComboBox comboBoxSelectorCompany;
|
private ComboBox comboBoxSelectorCompany;
|
||||||
private Button buttonAddAirBomber;
|
private Button buttonAddAirBomber;
|
||||||
private Button buttonAddAirPlane;
|
|
||||||
private PictureBox pictureBox;
|
private PictureBox pictureBox;
|
||||||
|
private Button buttonGoToCheck;
|
||||||
private Button buttonDelAirPlane;
|
private Button buttonDelAirPlane;
|
||||||
private MaskedTextBox maskedTextBox;
|
private MaskedTextBox maskedTextBox;
|
||||||
private Button buttonGoToCheck;
|
|
||||||
private Button buttonRefresh;
|
private Button buttonRefresh;
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using AirBomber.CollectionGenericObjects;
|
using AirBomber.CollectionGenericObjects;
|
||||||
|
using AirBomber.Drawnings;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -9,9 +10,9 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AirBomber;
|
namespace AirBomber
|
||||||
|
{
|
||||||
public partial class FormBoatCollection : Form
|
public partial class FormAirPlaneCollection : Form
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Компания
|
/// Компания
|
||||||
@ -21,7 +22,7 @@ public partial class FormBoatCollection : Form
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FormBoatCollection()
|
public FormAirPlaneCollection()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
@ -36,7 +37,7 @@ public partial class FormBoatCollection : Form
|
|||||||
switch (comboBoxSelectorCompany.Text)
|
switch (comboBoxSelectorCompany.Text)
|
||||||
{
|
{
|
||||||
case "Хранилище":
|
case "Хранилище":
|
||||||
_company = new BoatSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningBoat>());
|
_company = new AirPlaneSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningAirPlane>());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,16 +52,16 @@ public partial class FormBoatCollection : Form
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DrawningBoat _drawningBoat;
|
DrawningAirPlane _drawningAirPlane;
|
||||||
Random random = new();
|
Random random = new();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case nameof(DrawningBoat):
|
case nameof(DrawningAirPlane):
|
||||||
_drawningBoat = new DrawningBoat(random.Next(30, 70), random.Next(100, 500),
|
_drawningAirPlane = new DrawningAirPlane(random.Next(30, 70), random.Next(100, 500),
|
||||||
GetColor(random));
|
GetColor(random));
|
||||||
break;
|
break;
|
||||||
case nameof(DrawningCatamaran):
|
case nameof(DrawningAirBomber):
|
||||||
_drawningBoat = new DrawningCatamaran(random.Next(30, 70), random.Next(100, 500),
|
_drawningAirPlane = new DrawningAirBomber(random.Next(30, 70), random.Next(100, 500),
|
||||||
GetColor(random), GetColor(random),
|
GetColor(random), GetColor(random),
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
break;
|
break;
|
||||||
@ -69,7 +70,7 @@ public partial class FormBoatCollection : Form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_company + _drawningBoat != -1)
|
if (_company + _drawningAirPlane != -1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBox.Image = _company.Show();
|
pictureBox.Image = _company.Show();
|
||||||
@ -85,14 +86,14 @@ public partial class FormBoatCollection : Form
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void buttonAddBoat_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBoat));
|
private void buttonAddAirPlane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirPlane));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Добавление спортивного автомобиля
|
/// Добавление спортивного автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void buttonAddCatamaran_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningCatamaran));
|
private void buttonAddAirBomber_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirBomber));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение цвета
|
/// Получение цвета
|
||||||
@ -116,9 +117,9 @@ public partial class FormBoatCollection : Form
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void ButtonRemoveBoat_Click(object sender, EventArgs e)
|
private void ButtonRemoveAirPlane_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
|
if (string.IsNullOrEmpty(maskedTextBox.Text) || _company == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -128,7 +129,7 @@ public partial class FormBoatCollection : Form
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
int pos = Convert.ToInt32(maskedTextBox.Text);
|
||||||
if (_company - pos != null)
|
if (_company - pos != null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
@ -152,7 +153,7 @@ public partial class FormBoatCollection : Form
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawningBoat? airplane = null;
|
DrawningAirPlane? airplane = null;
|
||||||
int counter = 100;
|
int counter = 100;
|
||||||
while (airplane == null)
|
while (airplane == null)
|
||||||
{
|
{
|
||||||
@ -169,8 +170,8 @@ public partial class FormBoatCollection : Form
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCatamaran form = new FormCatamaran();
|
FormAirBomber form = new FormAirBomber();
|
||||||
form.SetBoat = airplane;
|
form.SetAirPlane = airplane;
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,3 +190,4 @@ public partial class FormBoatCollection : Form
|
|||||||
pictureBox.Image = _company.Show();
|
pictureBox.Image = _company.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace AirBomber
|
|||||||
// 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 FormAirBomber());
|
Application.Run(new FormAirPlaneCollection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user