diff --git a/ProjectStormtrooper/CollectionGenericObjects/AbstractCompany.cs b/ProjectStormtrooper/CollectionGenericObjects/AbstractCompany.cs index 0a07d83..01bd6af 100644 --- a/ProjectStormtrooper/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectStormtrooper/CollectionGenericObjects/AbstractCompany.cs @@ -1,9 +1,4 @@ using ProjectStormtrooper.Drawnings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ProjectStormtrooper.CollectionGenericObjects; @@ -62,9 +57,9 @@ public abstract class AbstractCompany /// Компания /// Добавляемый объект /// - public static bool operator +(AbstractCompany company, DrawningAirplane airplane) + public static int operator +(AbstractCompany company, DrawningAirplane airplane) { - return company._collection?.Insert(airplane) ?? false; + return company._collection.Insert(airplane); } /// @@ -73,9 +68,9 @@ public abstract class AbstractCompany /// Компания /// Номер удаляемого объекта /// - public static bool operator -(AbstractCompany company, int position) + public static DrawningAirplane operator -(AbstractCompany company, int position) { - return company._collection?.Remove(position) ?? false; + return company._collection?.Remove(position); } /// diff --git a/ProjectStormtrooper/CollectionGenericObjects/AirplaneSharingService.cs b/ProjectStormtrooper/CollectionGenericObjects/AirplaneSharingService.cs index f7b3605..cf2d2cc 100644 --- a/ProjectStormtrooper/CollectionGenericObjects/AirplaneSharingService.cs +++ b/ProjectStormtrooper/CollectionGenericObjects/AirplaneSharingService.cs @@ -1,9 +1,5 @@ using ProjectStormtrooper.Drawnings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Drawing; namespace ProjectStormtrooper.CollectionGenericObjects; @@ -23,10 +19,45 @@ public class AirplaneSharingService : AbstractCompany } protected override void DrawBackgound(Graphics g) { - throw new NotImplementedException(); + //рисуем пристань + int width = _pictureWidth / _placeSizeWidth; + int height = _pictureHeight / _placeSizeHeight; + Pen pen = new(Color.Black, 3); + for (int i = 0; i < width; i++) + { + for (int j = 0; j < height + 1; ++j) + { + g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 5, j * _placeSizeHeight); + } + } } + protected override void SetObjectsPosition() { - throw new NotImplementedException(); + int width = _pictureWidth / _placeSizeWidth; + int height = _pictureHeight / _placeSizeHeight; + + int curWidth = width - 1; + int curHeight = 0; + + for (int i = 0; i < (_collection?.Count ?? 0); i++) + { + if (_collection.Get(i) != null) + { + _collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight); + _collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 20, curHeight * _placeSizeHeight + 4); + } + if (curWidth > 0) + curWidth--; + else + { + curWidth = width - 1; + curHeight++; + } + if (curHeight > height) + { + return; + } + } } } diff --git a/ProjectStormtrooper/CollectionGenericObjects/ICollectionGenericObjects.cs b/ProjectStormtrooper/CollectionGenericObjects/ICollectionGenericObjects.cs index 856c64b..6e87375 100644 --- a/ProjectStormtrooper/CollectionGenericObjects/ICollectionGenericObjects.cs +++ b/ProjectStormtrooper/CollectionGenericObjects/ICollectionGenericObjects.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.CollectionGenericObjects; +namespace ProjectStormtrooper.CollectionGenericObjects; public interface ICollectionGenericObjects where T : class @@ -23,23 +17,23 @@ public interface ICollectionGenericObjects /// Добавление объекта в коллекцию /// /// Добавляемый объект - /// true - вставка прошла удачно, false - вставка не удалась - bool Insert(T obj); + /// Код результата вставки + int Insert(T obj); /// /// Добавление объекта в коллекцию на конкретную позицию /// /// Добавляемый объект /// Позиция - /// true - вставка прошла удачно, false - вставка не удалась - bool Insert(T obj, int position); + /// Код результата вставки + int Insert(T obj, int position); /// /// Удаление объекта из коллекции с конкретной позиции /// /// Позиция - /// true - удаление прошло удачно, false - удаление не удалось - bool Remove(int position); + /// Код результата удаления + T Remove(int position); /// /// Получение объекта по позиции @@ -47,4 +41,4 @@ public interface ICollectionGenericObjects /// Позиция /// Объект T? Get(int position); -} +} \ No newline at end of file diff --git a/ProjectStormtrooper/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectStormtrooper/CollectionGenericObjects/MassiveGenericObjects.cs index 594ace0..f9df8b6 100644 --- a/ProjectStormtrooper/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectStormtrooper/CollectionGenericObjects/MassiveGenericObjects.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using ProjectStormtrooper.CollectionGenericObjects; namespace ProjectStormtrooper.CollectionGenericObjects; @@ -13,26 +9,8 @@ public class MassiveGenericObjects : ICollectionGenericObjects /// Массив объектов, которые храним /// private T?[] _collection; - public int Count => _collection.Length; - - public int SetMaxCount - { - set - { - if (value > 0) - { - if (_collection.Length > 0) - { - Array.Resize(ref _collection, value); - } - else - { - _collection = new T?[value]; - } - } - } - } + public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } } /// /// Конструктор @@ -42,32 +20,71 @@ public class MassiveGenericObjects : ICollectionGenericObjects _collection = Array.Empty(); } - public T? Get(int position) + public T? Get(int position) // получение с позиции { - // TODO проверка позиции + if (position < 0 || position >= _collection.Length) // если позиция передано неправильно + return null; return _collection[position]; } - - public bool Insert(T obj) + public int Insert(T obj) { // TODO вставка в свободное место набора - return false; + int index = 0; + while (index < _collection.Length) + { + if (_collection[index] == null) + { + _collection[index] = obj; + return index; + } + ++index; + } + return -1; } - - public bool Insert(T obj, int position) + public int Insert(T obj, int position) { // TODO проверка позиции // TODO проверка, что элемент массива по этой позиции пустой, если нет, то - // ищется свободное место после этой позиции и идет вставка туда - // если нет после, ищем до + // ищется свободное место после этой позиции и идет вставка туда + // если нет после, ищем до // TODO вставка - return false; + if (position >= _collection.Length || position < 0) + return -1; + if (_collection[position] == null) + { + _collection[position] = obj; + return position; + } + int index = position + 1; + while (index < _collection.Length) + { + if (_collection[index] == null) + { + _collection[index] = obj; + return index; + } + ++index; + } + index = position - 1; + while (index >= 0) + { + if (_collection[index] == null) + { + _collection[index] = obj; + return index; + } + --index; + } + return -1; } - - public bool Remove(int position) + public T Remove(int position) { // TODO проверка позиции // TODO удаление объекта из массива, присвоив элементу массива значение null - return true; + if (position >= _collection.Length || position < 0) + return null; + T obj = _collection[position]; + _collection[position] = null; + return obj; } } diff --git a/ProjectStormtrooper/Drawnings/DirectionType.cs b/ProjectStormtrooper/Drawnings/DirectionType.cs index 935c295..0c58d01 100644 --- a/ProjectStormtrooper/Drawnings/DirectionType.cs +++ b/ProjectStormtrooper/Drawnings/DirectionType.cs @@ -23,5 +23,6 @@ public enum DirectionType /// /// Вправо /// - Right = 4 + Right = 4, + Unknow = 5 } \ No newline at end of file diff --git a/ProjectStormtrooper/Drawnings/DrawningAirplane.cs b/ProjectStormtrooper/Drawnings/DrawningAirplane.cs index 5f472d9..9c46cdb 100644 --- a/ProjectStormtrooper/Drawnings/DrawningAirplane.cs +++ b/ProjectStormtrooper/Drawnings/DrawningAirplane.cs @@ -1,9 +1,4 @@ using ProjectStormtrooper.Entites; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ProjectStormtrooper.Drawnings; @@ -94,8 +89,8 @@ public class DrawningAirplane /// Высота прорисовки самолета protected DrawningAirplane(int drawningAirplaneWidth, int drawningAirplaneHeight) : this() { - _drawningAirplaneWidth = drawningAirplaneWidth; - _pictureHeight = drawningAirplaneHeight; + this._drawningAirplaneWidth = drawningAirplaneWidth; + this._pictureHeight = drawningAirplaneHeight; } /// @@ -108,8 +103,22 @@ public class DrawningAirplane { // TODO проверка, что объект "влезает" в размеры поля // если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена + if (width < _drawningAirplaneWidth || height < _drawningAirplaneHeight) return false; _pictureWidth = width; _pictureHeight = height; + if (_startPosX != null || _startPosY != null) + { + if (_startPosX + _drawningAirplaneWidth > _pictureWidth) + { + _startPosX = _startPosX - (_startPosX + _drawningAirplaneWidth - _pictureWidth); + } + else if (_startPosX < 0) _startPosX = 0; + if (_startPosY + _drawningAirplaneHeight > _pictureHeight) + { + _startPosY = _startPosY - (_startPosY + _drawningAirplaneHeight - _pictureHeight); + } + else if (_startPosY < 0) _startPosY = 0; + } return true; } @@ -127,8 +136,18 @@ public class DrawningAirplane // TODO если при установке объекта в эти координаты, он будет "выходить" за границы формы // то надо изменить координаты, чтобы он оставался в этих границах - _startPosX = x; - _startPosY = y; + if (x + _drawningAirplaneWidth > _pictureWidth) + { + _startPosX = x - (x + _drawningAirplaneWidth - _pictureWidth); + } + else if (x < 0) _startPosX = 0; + else _startPosX = x; + if (y + _drawningAirplaneHeight > _pictureHeight) + { + _startPosY = y - (y + _drawningAirplaneHeight - _pictureHeight); + } + else if (y < 0) _startPosY = 0; + else _startPosY = y; } diff --git a/ProjectStormtrooper/Drawnings/DrawningStormtrooper.cs b/ProjectStormtrooper/Drawnings/DrawningStormtrooper.cs index 24632c2..3d98f18 100644 --- a/ProjectStormtrooper/Drawnings/DrawningStormtrooper.cs +++ b/ProjectStormtrooper/Drawnings/DrawningStormtrooper.cs @@ -21,10 +21,6 @@ public class DrawningStormtrooper : DrawningAirplane EntityAirplane = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, dvigatel, vint); } - public DrawningStormtrooper(int speed, double weight, Color bodyColor, Color additionalColor, bool dvigatel, bool vint, bool v) : this(speed, weight, bodyColor, additionalColor, dvigatel, vint) - { - } - public override void DrawTransport(Graphics g) { if (EntityAirplane == null || EntityAirplane is not EntityStormtrooper stormtrooper || !_startPosX.HasValue || !_startPosY.HasValue) diff --git a/ProjectStormtrooper/Entites/EntityAirplane.cs b/ProjectStormtrooper/Entites/EntityAirplane.cs index 60010dc..ac43fb7 100644 --- a/ProjectStormtrooper/Entites/EntityAirplane.cs +++ b/ProjectStormtrooper/Entites/EntityAirplane.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.Entites; +namespace ProjectStormtrooper.Entites; /// /// Класс-сущность "Самолет" diff --git a/ProjectStormtrooper/Entites/EntityStormtrooper.cs b/ProjectStormtrooper/Entites/EntityStormtrooper.cs index 5c18c5c..2c5b95c 100644 --- a/ProjectStormtrooper/Entites/EntityStormtrooper.cs +++ b/ProjectStormtrooper/Entites/EntityStormtrooper.cs @@ -6,54 +6,27 @@ public class EntityStormtrooper : EntityAirplane { /// - /// Скорость - /// - public int Speed { get; private set; } - - /// - /// Вес - /// - public double Weight { get; private set; } - - /// - /// Основной цвет - /// - public Color BodyColor { get; private set; } - - /// - /// Дополнительный цвет (для опциональных элементов) + /// Дополнительтный цвет /// public Color AdditionalColor { get; private set; } - /// - /// Признак (опция) наличия обвеса - /// - public bool Dvigatel { get; private set; } - - /// - /// Признак (опция) наличия антикрыла + /// Признак наличия труб /// public bool Vint { get; private set; } - - /// - /// Шаг перемещения самолета + /// Признак наличия топливного бака /// - public double Step => Speed * 100 / Weight; - + public bool Dvigatel { get; private set; } /// - /// Инициализация полей объекта-класса штурмовика + /// Инициализация полей класса EntityStormtrooper /// - /// Скорость - /// Вес автомобиля - /// Основной цвет - /// Дополнительный цвет - /// Признак наличия обвеса - /// Признак наличия антикрыла - public EntityStormtrooper(int speed, double weight, Color bodyColor, Color additionalColor, bool dvigatel, bool vint) : base(speed, weight, bodyColor) + /// + /// + /// + public EntityStormtrooper(int speed, double weight, Color bodycolor, Color additionalcolor, bool vint, bool dvigatel) : base(speed, weight, bodycolor) { - AdditionalColor = additionalColor; - Dvigatel = dvigatel; + AdditionalColor = additionalcolor; Vint = vint; + Dvigatel = dvigatel; } } \ No newline at end of file diff --git a/ProjectStormtrooper/FormAirplaneCollection.Designer.cs b/ProjectStormtrooper/FormAirplaneCollection.Designer.cs index 0b5ece2..348f9e4 100644 --- a/ProjectStormtrooper/FormAirplaneCollection.Designer.cs +++ b/ProjectStormtrooper/FormAirplaneCollection.Designer.cs @@ -1,5 +1,4 @@ - -namespace ProjectStormtrooper +namespace ProjectStormtrooper { partial class FormAirplaneCollection { @@ -52,75 +51,84 @@ namespace ProjectStormtrooper groupBoxTools.Controls.Add(buttonAddAirplane); groupBoxTools.Controls.Add(comboBoxSelectorCompany); groupBoxTools.Dock = DockStyle.Right; - groupBoxTools.Location = new Point(819, 0); + groupBoxTools.Location = new Point(894, 0); + groupBoxTools.Margin = new Padding(3, 4, 3, 4); groupBoxTools.Name = "groupBoxTools"; - groupBoxTools.Size = new Size(235, 663); + groupBoxTools.Padding = new Padding(3, 4, 3, 4); + groupBoxTools.Size = new Size(205, 821); groupBoxTools.TabIndex = 0; groupBoxTools.TabStop = false; groupBoxTools.Text = "Инструменты"; - groupBoxTools.Enter += groupBoxTools_Enter; // // buttonRefresh // buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonRefresh.Location = new Point(6, 588); + buttonRefresh.Location = new Point(7, 665); + buttonRefresh.Margin = new Padding(3, 4, 3, 4); buttonRefresh.Name = "buttonRefresh"; - buttonRefresh.Size = new Size(217, 63); + buttonRefresh.Size = new Size(191, 53); buttonRefresh.TabIndex = 6; buttonRefresh.Text = "Обновить"; buttonRefresh.UseVisualStyleBackColor = true; + buttonRefresh.Click += buttonRefresh_Click; // // buttonGoToCheck // buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonGoToCheck.Location = new Point(6, 485); + buttonGoToCheck.Location = new Point(7, 481); + buttonGoToCheck.Margin = new Padding(3, 4, 3, 4); buttonGoToCheck.Name = "buttonGoToCheck"; - buttonGoToCheck.Size = new Size(217, 63); + buttonGoToCheck.Size = new Size(191, 53); buttonGoToCheck.TabIndex = 5; buttonGoToCheck.Text = "Передать на тесты"; buttonGoToCheck.UseVisualStyleBackColor = true; + buttonGoToCheck.Click += buttonGoToCheck_Click; // // buttonRemoveAirplane // buttonRemoveAirplane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonRemoveAirplane.Location = new Point(6, 373); + buttonRemoveAirplane.Location = new Point(7, 335); + buttonRemoveAirplane.Margin = new Padding(3, 4, 3, 4); buttonRemoveAirplane.Name = "buttonRemoveAirplane"; - buttonRemoveAirplane.Size = new Size(217, 63); + buttonRemoveAirplane.Size = new Size(191, 53); buttonRemoveAirplane.TabIndex = 4; - buttonRemoveAirplane.Text = "Удалить штурмовика"; + buttonRemoveAirplane.Text = "Удалить автомобиль"; buttonRemoveAirplane.UseVisualStyleBackColor = true; buttonRemoveAirplane.Click += buttonRemoveAirplane_Click; // // maskedTextBox // - maskedTextBox.Location = new Point(6, 340); + maskedTextBox.Location = new Point(7, 296); + maskedTextBox.Margin = new Padding(3, 4, 3, 4); maskedTextBox.Mask = "00"; maskedTextBox.Name = "maskedTextBox"; - maskedTextBox.Size = new Size(217, 27); + maskedTextBox.Size = new Size(190, 27); maskedTextBox.TabIndex = 3; maskedTextBox.ValidatingType = typeof(int); // // buttonAddStormtrooper // buttonAddStormtrooper.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddStormtrooper.Location = new Point(6, 203); + buttonAddStormtrooper.Location = new Point(7, 183); + buttonAddStormtrooper.Margin = new Padding(3, 4, 3, 4); buttonAddStormtrooper.Name = "buttonAddStormtrooper"; - buttonAddStormtrooper.Size = new Size(217, 63); + buttonAddStormtrooper.Size = new Size(191, 53); buttonAddStormtrooper.TabIndex = 2; buttonAddStormtrooper.Text = "Добавление штурмовика"; buttonAddStormtrooper.UseVisualStyleBackColor = true; - buttonAddStormtrooper.Click += buttonAddStormtrooper_Click_1; + buttonAddStormtrooper.Click += buttonAddStormtrooper_Click; // // buttonAddAirplane // buttonAddAirplane.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - buttonAddAirplane.Location = new Point(6, 119); + buttonAddAirplane.Location = new Point(7, 121); + buttonAddAirplane.Margin = new Padding(3, 4, 3, 4); buttonAddAirplane.Name = "buttonAddAirplane"; - buttonAddAirplane.Size = new Size(217, 63); + buttonAddAirplane.Size = new Size(191, 53); buttonAddAirplane.TabIndex = 1; buttonAddAirplane.Text = "Добавление самолета"; buttonAddAirplane.UseVisualStyleBackColor = true; - buttonAddAirplane.Click += buttonAddAirplane_Click_1; + buttonAddAirplane.Click += buttonAddAirplane_Click; // // comboBoxSelectorCompany // @@ -128,51 +136,49 @@ namespace ProjectStormtrooper comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxSelectorCompany.FormattingEnabled = true; comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" }); - comboBoxSelectorCompany.Location = new Point(6, 26); + comboBoxSelectorCompany.Location = new Point(7, 29); + comboBoxSelectorCompany.Margin = new Padding(3, 4, 3, 4); comboBoxSelectorCompany.Name = "comboBoxSelectorCompany"; - comboBoxSelectorCompany.Size = new Size(217, 28); + comboBoxSelectorCompany.Size = new Size(190, 28); comboBoxSelectorCompany.TabIndex = 0; + comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged; // // pictureBox // pictureBox.Dock = DockStyle.Fill; pictureBox.Location = new Point(0, 0); + pictureBox.Margin = new Padding(3, 4, 3, 4); pictureBox.Name = "pictureBox"; - pictureBox.Size = new Size(819, 663); + pictureBox.Size = new Size(894, 821); pictureBox.TabIndex = 1; pictureBox.TabStop = false; - pictureBox.Click += pictureBox_Click; // // FormAirplaneCollection // AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1054, 663); + ClientSize = new Size(1099, 821); Controls.Add(pictureBox); Controls.Add(groupBoxTools); + Margin = new Padding(3, 4, 3, 4); Name = "FormAirplaneCollection"; - Text = "Коллекция самолетов"; + Text = "Коллекция автомобилей"; groupBoxTools.ResumeLayout(false); groupBoxTools.PerformLayout(); ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit(); ResumeLayout(false); } - private void buttonRemoveAirplane_Click(object sender, EventArgs e) - { - throw new NotImplementedException(); - } - #endregion private GroupBox groupBoxTools; private ComboBox comboBoxSelectorCompany; private Button buttonAddStormtrooper; private Button buttonAddAirplane; + private Button buttonRemoveAirplane; private MaskedTextBox maskedTextBox; private PictureBox pictureBox; - private Button buttonRemoveAirplane; - private Button buttonRefresh; private Button buttonGoToCheck; + private Button buttonRefresh; } } \ No newline at end of file diff --git a/ProjectStormtrooper/FormAirplaneCollection.cs b/ProjectStormtrooper/FormAirplaneCollection.cs index ff7ca8e..160d2b5 100644 --- a/ProjectStormtrooper/FormAirplaneCollection.cs +++ b/ProjectStormtrooper/FormAirplaneCollection.cs @@ -1,17 +1,11 @@ using ProjectStormtrooper.CollectionGenericObjects; using ProjectStormtrooper.Drawnings; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; namespace ProjectStormtrooper; +/// +/// Форма работы с компанией и ее коллекцией +/// public partial class FormAirplaneCollection : Form { /// @@ -47,44 +41,30 @@ public partial class FormAirplaneCollection : Form /// /// /// - private void ButtonAddAirplane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirplane)); - - /// - /// Добавление штурмовика - /// - /// - /// - private void ButtonAddStormtrooper_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningStormtrooper)); - - /// - /// Создание объекта класса-перемещения - /// - /// Тип создаваемого объекта private void CreateObject(string type) { if (_company == null) { return; } - Random random = new(); DrawningAirplane drawningAirplane; switch (type) { case nameof(DrawningAirplane): - drawningAirplane = new DrawningAirplane(random.Next(100, 300), random.Next(1000, 3000), GetColor(random)); + drawningAirplane = new DrawningAirplane(random.Next(100, 300), + random.Next(1000, 3000), GetColor(random)); break; case nameof(DrawningStormtrooper): + // TODO вызов диалогового окна для выбора цвета (made) drawningAirplane = new DrawningStormtrooper(random.Next(100, 300), random.Next(1000, 3000), - 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)), Convert.ToBoolean(random.Next(0, 2))); + GetColor(random), GetColor(random), + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); break; default: return; } - - if (_company + drawningAirplane) + if (_company + drawningAirplane != -1) { MessageBox.Show("Объект добавлен"); pictureBox.Image = _company.Show(); @@ -111,26 +91,26 @@ public partial class FormAirplaneCollection : Form return color; } - - /// - /// Удаление объекта - /// - /// - /// - private void ButtonRemoveCar_Click(object sender, EventArgs e) + private void buttonAddAirplane_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null) + CreateObject(nameof(DrawningAirplane)); + } + private void buttonAddStormtrooper_Click(object sender, EventArgs e) + { + CreateObject(nameof(DrawningStormtrooper)); + } + private void buttonRemoveAirplane_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(maskedTextBox.Text) || _company == null) { return; } - - if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) + if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } - - int pos = Convert.ToInt32(maskedTextBoxPosition.Text); - if (_company - pos) + int pos = Convert.ToInt32(maskedTextBox.Text); + if (_company - pos != null) { MessageBox.Show("Объект удален"); pictureBox.Image = _company.Show(); @@ -140,24 +120,39 @@ public partial class FormAirplaneCollection : Form MessageBox.Show("Не удалось удалить объект"); } } - - private void groupBoxTools_Enter(object sender, EventArgs e) + private void buttonGoToCheck_Click(object sender, EventArgs e) { - + if (_company == null) + { + return; + } + DrawningAirplane? airplane = null; + int counter = 100; + while (airplane == null) + { + airplane = _company.GetRandomObject(); + counter--; + if (counter <= 0) + { + break; + } + } + if (airplane == null) + { + return; + } + FormStormtrooper form = new() + { + SetAirplane = airplane + }; + form.ShowDialog(); } - - private void pictureBox_Click(object sender, EventArgs e) + private void buttonRefresh_Click(object sender, EventArgs e) { - - } - - private void buttonAddAirplane_Click_1(object sender, EventArgs e) - { - - } - - private void buttonAddStormtrooper_Click_1(object sender, EventArgs e) - { - + if (_company == null) + { + return; + } + pictureBox.Image = _company.Show(); } } diff --git a/ProjectStormtrooper/FormStormtrooper.Designer.cs b/ProjectStormtrooper/FormStormtrooper.Designer.cs index b38a47c..3f9bf75 100644 --- a/ProjectStormtrooper/FormStormtrooper.Designer.cs +++ b/ProjectStormtrooper/FormStormtrooper.Designer.cs @@ -19,7 +19,6 @@ partial class FormStormtrooper } base.Dispose(disposing); } - #region Windows Form Designer generated code /// @@ -29,12 +28,12 @@ partial class FormStormtrooper private void InitializeComponent() { pictureBoxStormtrooper = new PictureBox(); - buttonCreate = new Button(); - buttonRight = new Button(); - buttonUp = new Button(); buttonLeft = new Button(); + buttonUp = new Button(); buttonDown = new Button(); - buttonCreateAirplane = new Button(); + buttonRight = new Button(); + comboBoxStrategy = new ComboBox(); + buttonStrategyStep = new Button(); ((System.ComponentModel.ISupportInitialize)pictureBoxStormtrooper).BeginInit(); SuspendLayout(); // @@ -47,85 +46,89 @@ partial class FormStormtrooper pictureBoxStormtrooper.SizeMode = PictureBoxSizeMode.AutoSize; pictureBoxStormtrooper.TabIndex = 0; pictureBoxStormtrooper.TabStop = false; - pictureBoxStormtrooper.Click += pictureBoxStormtrooper_Click; // - // buttonCreate + // buttonLeft // - buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonCreate.Location = new Point(12, 477); - buttonCreate.Name = "buttonCreate"; - buttonCreate.Size = new Size(325, 29); - buttonCreate.TabIndex = 1; - buttonCreate.Text = "создать штурмовик"; - buttonCreate.UseVisualStyleBackColor = true; - buttonCreate.Click += buttonCreateStormtrooper_Click; - // - // buttonRight - // - buttonRight.BackgroundImage = Properties.Resources.arrowRight; - buttonRight.BackgroundImageLayout = ImageLayout.Stretch; - buttonRight.Location = new Point(1163, 466); - buttonRight.Name = "buttonRight"; - buttonRight.Size = new Size(40, 40); - buttonRight.TabIndex = 2; - buttonRight.UseVisualStyleBackColor = true; - buttonRight.Click += ButtonMove_Click; + buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonLeft.BackgroundImage = Properties.Resources.arrowLeft; + buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; + buttonLeft.Location = new Point(787, 550); + buttonLeft.Name = "buttonLeft"; + buttonLeft.Size = new Size(35, 35); + buttonLeft.TabIndex = 2; + buttonLeft.UseVisualStyleBackColor = true; + buttonLeft.Click += ButtonMove_Click; // // buttonUp // + buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonUp.BackgroundImage = Properties.Resources.arrowUp; buttonUp.BackgroundImageLayout = ImageLayout.Stretch; - buttonUp.Location = new Point(1117, 420); + buttonUp.Location = new Point(828, 509); buttonUp.Name = "buttonUp"; - buttonUp.Size = new Size(40, 40); + buttonUp.Size = new Size(35, 35); buttonUp.TabIndex = 3; buttonUp.UseVisualStyleBackColor = true; buttonUp.Click += ButtonMove_Click; // - // buttonLeft - // - buttonLeft.BackgroundImage = Properties.Resources.arrowLeft; - buttonLeft.BackgroundImageLayout = ImageLayout.Stretch; - buttonLeft.Location = new Point(1071, 466); - buttonLeft.Name = "buttonLeft"; - buttonLeft.Size = new Size(40, 40); - buttonLeft.TabIndex = 4; - buttonLeft.UseVisualStyleBackColor = true; - buttonLeft.Click += ButtonMove_Click; - // // buttonDown // + buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonDown.BackgroundImage = Properties.Resources.arrowDown; buttonDown.BackgroundImageLayout = ImageLayout.Stretch; - buttonDown.Location = new Point(1117, 466); + buttonDown.Location = new Point(828, 550); buttonDown.Name = "buttonDown"; - buttonDown.Size = new Size(40, 40); - buttonDown.TabIndex = 5; + buttonDown.Size = new Size(35, 35); + buttonDown.TabIndex = 4; buttonDown.UseVisualStyleBackColor = true; buttonDown.Click += ButtonMove_Click; // - // buttonCreateAirplane + // buttonRight // - buttonCreateAirplane.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; - buttonCreateAirplane.Location = new Point(343, 477); - buttonCreateAirplane.Name = "buttonCreateAirplane"; - buttonCreateAirplane.Size = new Size(325, 29); - buttonCreateAirplane.TabIndex = 6; - buttonCreateAirplane.Text = "создать самолет"; - buttonCreateAirplane.UseVisualStyleBackColor = true; - buttonCreateAirplane.Click += ButtonCreateAirplane_Click; + buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonRight.BackgroundImage = Properties.Resources.arrowRight; + buttonRight.BackgroundImageLayout = ImageLayout.Stretch; + buttonRight.Location = new Point(869, 550); + buttonRight.Name = "buttonRight"; + buttonRight.Size = new Size(35, 35); + buttonRight.TabIndex = 5; + buttonRight.UseVisualStyleBackColor = true; + buttonRight.Click += ButtonMove_Click; + // + // comboBoxStrategy + // + comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStrategy.FormattingEnabled = true; + comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" }); + comboBoxStrategy.Location = new Point(790, 12); + comboBoxStrategy.Name = "comboBoxStrategy"; + comboBoxStrategy.Size = new Size(121, 23); + comboBoxStrategy.TabIndex = 7; + // + // buttonStrategyStep + // + buttonStrategyStep.Location = new Point(836, 41); + buttonStrategyStep.Name = "buttonStrategyStep"; + buttonStrategyStep.Size = new Size(75, 23); + buttonStrategyStep.TabIndex = 8; + buttonStrategyStep.Text = "Шаг"; + buttonStrategyStep.UseVisualStyleBackColor = true; + buttonStrategyStep.Click += ButtonStrategyStep_Click; // // FormStormtrooper // - ClientSize = new Size(1268, 518); - Controls.Add(buttonCreateAirplane); - Controls.Add(buttonDown); - Controls.Add(buttonLeft); - Controls.Add(buttonUp); + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(923, 597); + Controls.Add(buttonStrategyStep); + Controls.Add(comboBoxStrategy); Controls.Add(buttonRight); - Controls.Add(buttonCreate); + Controls.Add(buttonDown); + Controls.Add(buttonUp); + Controls.Add(buttonLeft); Controls.Add(pictureBoxStormtrooper); Name = "FormStormtrooper"; + Text = "Штурмовик"; ((System.ComponentModel.ISupportInitialize)pictureBoxStormtrooper).EndInit(); ResumeLayout(false); PerformLayout(); @@ -134,11 +137,11 @@ partial class FormStormtrooper #endregion private PictureBox pictureBoxStormtrooper; - private Button buttonCreate; - private Button buttonRight; - private Button buttonUp; private Button buttonLeft; + private Button buttonUp; private Button buttonDown; - private Button buttonCreateAirplane; + private Button buttonRight; + private ComboBox comboBoxStrategy; + private Button buttonStrategyStep; } diff --git a/ProjectStormtrooper/FormStormtrooper.cs b/ProjectStormtrooper/FormStormtrooper.cs index 9d8df2c..4de5a0a 100644 --- a/ProjectStormtrooper/FormStormtrooper.cs +++ b/ProjectStormtrooper/FormStormtrooper.cs @@ -1,25 +1,45 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ProjectStormtrooper.Drawnings; +using ProjectStormtrooper.Drawnings; +using ProjectStormtrooper.MovementStrategy; namespace ProjectStormtrooper; +/// +/// Форма работы с объектом "Штурмовик" +/// public partial class FormStormtrooper : Form { - + /// + /// Поле-объект для прорисовки объекта + /// private DrawningAirplane? _drawningAirplane; + /// + /// Стратегия перемещения + /// + private AbstractStrategy? _strategy; + + /// + /// Получение объекта + /// + public DrawningAirplane SetAirplane + { + set + { + _drawningAirplane = value; + _drawningAirplane.SetPictureSize(pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height); + comboBoxStrategy.Enabled = true; + _strategy = null; + Draw(); + } + } + + /// + /// Конструктор формы + /// public FormStormtrooper() { InitializeComponent(); + _strategy = null; } /// @@ -36,50 +56,6 @@ public partial class FormStormtrooper : Form _drawningAirplane.DrawTransport(gr); pictureBoxStormtrooper.Image = bmp; } - /// - /// Создание объекта класса-перемещения - /// - /// Тип создаваемого объекта - private void CreateObject(string type) - { - Random random = new(); - switch (type) - { - case nameof(DrawningAirplane): - _drawningAirplane = new DrawningAirplane(random.Next(100, 300), random.Next(1000, 3000), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); - break; - case nameof(DrawningStormtrooper): - _drawningAirplane = new DrawningStormtrooper(random.Next(100, 300), random.Next(1000, 3000), - 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)), Convert.ToBoolean(random.Next(0, 2))); - break; - default: - return; - } - - _drawningAirplane.SetPictureSize(pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height); - _drawningAirplane.SetPosition(random.Next(10, 100), random.Next(10, 100)); - Draw(); - } - - /// - /// Обработка нажатия кнопки "Создать штурмовик" - /// - /// - /// - - - private void buttonCreateStormtrooper_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningStormtrooper)); - - /// - /// Обработка нажатия кнопки "Создать самолет" - /// - /// - /// - /// - private void ButtonCreateAirplane_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningAirplane)); /// /// Перемещение объекта по форме (нажатие кнопок навигации) @@ -119,15 +95,48 @@ public partial class FormStormtrooper : Form } } - private void pictureBoxStormtrooper_Click(object sender, EventArgs e) - { - - } - /// /// Обработка нажатия кнопки "Шаг" /// /// /// + /// + private void ButtonStrategyStep_Click(object sender, EventArgs e) + { + if (_drawningAirplane == null) + { + return; + } + + if (comboBoxStrategy.Enabled) + { + _strategy = comboBoxStrategy.SelectedIndex switch + { + 0 => new MoveToCenter(), + 1 => new MoveToBorder(), + _ => null, + }; + if (_strategy == null) + { + return; + } + _strategy.SetData(new MoveableAirplane(_drawningAirplane), pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height); + } + + if (_strategy == null) + { + return; + } + + comboBoxStrategy.Enabled = false; + _strategy.MakeStep(); + Draw(); + + if (_strategy.GetStatus() == StrategyStatus.Finish) + { + comboBoxStrategy.Enabled = true; + _strategy = null; + } + } } diff --git a/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs b/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs index 401b54e..15b6484 100644 --- a/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs +++ b/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; /// /// Класс-стратегия перемещения объекта @@ -61,17 +55,12 @@ public abstract class AbstractStrategy /// public void MakeStep() { - if (_state != StrategyStatus.InProgress) - { - return; - } - + if (_state != StrategyStatus.InProgress) return; if (IsTargetDestinaion()) { _state = StrategyStatus.Finish; return; } - MoveToTarget(); } diff --git a/ProjectStormtrooper/MovementStrategy/IMoveableObject.cs b/ProjectStormtrooper/MovementStrategy/IMoveableObject.cs index 2c0b51b..f581c05 100644 --- a/ProjectStormtrooper/MovementStrategy/IMoveableObject.cs +++ b/ProjectStormtrooper/MovementStrategy/IMoveableObject.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; /// /// Интерфейс для работы с перемещаемым объектом diff --git a/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs b/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs index d7c381e..81b18cd 100644 --- a/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs +++ b/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; public class MoveToBorder : AbstractStrategy { @@ -15,8 +9,10 @@ public class MoveToBorder : AbstractStrategy { return false; } - return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth && - objParams.DownBorder <= FieldHeight && objParams.DownBorder + GetStep() >= FieldHeight; + return objParams.LeftBorder - GetStep() <= 0 || + objParams.RightBorder + GetStep() >= FieldWidth || + objParams.TopBorder - GetStep() <= 0 + || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight; } protected override void MoveToTarget() @@ -26,29 +22,10 @@ public class MoveToBorder : AbstractStrategy { return; } - int diffX = objParams.RightBorder - FieldWidth; - if (Math.Abs(diffX) > GetStep()) - { - if (diffX > 0) - { - MoveLeft(); - } - else - { - MoveRight(); - } - } - int diffY = objParams.DownBorder - FieldHeight; - if (Math.Abs(diffY) > GetStep()) - { - if (diffY > 0) - { - MoveUp(); - } - else - { - MoveDown(); - } - } + //реализация в правый нижний угол + int x = objParams.RightBorder; + if (x + GetStep() < FieldWidth) MoveRight(); + int y = objParams.DownBorder; + if (y + GetStep() < FieldHeight) MoveDown(); } } \ No newline at end of file diff --git a/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs b/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs index 6ec6118..3cbdfc7 100644 --- a/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs +++ b/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; /// /// Стратегия перемещения объекта в центр экрана @@ -18,9 +12,10 @@ public class MoveToCenter : AbstractStrategy { return false; } - - return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && - objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; + return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && + objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && + objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 + && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; } protected override void MoveToTarget() @@ -30,7 +25,6 @@ public class MoveToCenter : AbstractStrategy { return; } - int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2; if (Math.Abs(diffX) > GetStep()) { @@ -43,7 +37,6 @@ public class MoveToCenter : AbstractStrategy MoveRight(); } } - int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; if (Math.Abs(diffY) > GetStep()) { diff --git a/ProjectStormtrooper/MovementStrategy/MoveableAirplane.cs b/ProjectStormtrooper/MovementStrategy/MoveableAirplane.cs index 3dfc0a2..46b2039 100644 --- a/ProjectStormtrooper/MovementStrategy/MoveableAirplane.cs +++ b/ProjectStormtrooper/MovementStrategy/MoveableAirplane.cs @@ -1,55 +1,37 @@ using ProjectStormtrooper.Drawnings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace ProjectStormtrooper.MovementStrategy; /// /// Класс-реализация IMoveableObject с использованием DrawningCar /// -public class MoveableCar : IMoveableObject +public class MoveableAirplane : IMoveableObject { - /// - /// Поле-объект класса DrawningCar или его наследника - /// - private readonly DrawningAirplane? _car = null; - - /// - /// Конструктор - /// - /// Объект класса DrawningCar - public MoveableCar(DrawningAirplane car) + private DrawningAirplane? _drawningairplane; + public MoveableAirplane(DrawningAirplane? drawningairplane) { - _car = car; + _drawningairplane = drawningairplane; } - public ObjectParameters? GetObjectPosition { get { - if (_car == null || _car.EntityAirplane == null || !_car.GetPosX.HasValue || !_car.GetPosY.HasValue) + if (_drawningairplane == null || _drawningairplane.EntityAirplane == null || !_drawningairplane.GetPosX.HasValue || !_drawningairplane.GetPosY.HasValue) { return null; } - return new ObjectParameters(_car.GetPosX.Value, _car.GetPosY.Value, _car.GetWidth, _car.GetHeight); + return new ObjectParameters(_drawningairplane.GetPosX.Value, _drawningairplane.GetPosY.Value, _drawningairplane.GetWidth, _drawningairplane.GetHeight); } } - - public int GetStep => (int)(_car?.EntityAirplane?.Step ?? 0); - + public int GetStep => (int)(_drawningairplane?.EntityAirplane?.Step ?? 0); public bool TryMoveObject(MovementDirection direction) { - if (_car == null || _car.EntityAirplane == null) + if (_drawningairplane == null || _drawningairplane.EntityAirplane == null) { return false; } - - return _car.MoveTransport(GetDirectionType(direction)); + return _drawningairplane.MoveTransport(GetDirectionType(direction)); } - /// /// Конвертация из MovementDirection в DirectionType /// diff --git a/ProjectStormtrooper/MovementStrategy/MovementDirection.cs b/ProjectStormtrooper/MovementStrategy/MovementDirection.cs index 62a3ede..c500131 100644 --- a/ProjectStormtrooper/MovementStrategy/MovementDirection.cs +++ b/ProjectStormtrooper/MovementStrategy/MovementDirection.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; public enum MovementDirection { diff --git a/ProjectStormtrooper/MovementStrategy/ObjectParametrs.cs b/ProjectStormtrooper/MovementStrategy/ObjectParametrs.cs index 479e09e..f1adbc6 100644 --- a/ProjectStormtrooper/MovementStrategy/ObjectParametrs.cs +++ b/ProjectStormtrooper/MovementStrategy/ObjectParametrs.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; /// /// Параметры-координаты объекта diff --git a/ProjectStormtrooper/Program.cs b/ProjectStormtrooper/Program.cs index 68f03c6..49b46b4 100644 --- a/ProjectStormtrooper/Program.cs +++ b/ProjectStormtrooper/Program.cs @@ -11,7 +11,7 @@ namespace ProjectStormtrooper // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormStormtrooper()); + Application.Run(new FormAirplaneCollection()); } } } \ No newline at end of file