Добавлена возможность добавлять различные типы двигателя для генерации

This commit is contained in:
Данияр Аглиуллов 2022-09-30 23:31:09 +04:00
parent 7259d846ed
commit 52c040d55b
2 changed files with 46 additions and 18 deletions

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.comboTypeEngines = new System.Windows.Forms.ComboBox();
this.groupBoxTools = new System.Windows.Forms.GroupBox();
this.labelSpeed = new System.Windows.Forms.Label();
this.numericSpeed = new System.Windows.Forms.NumericUpDown();
@ -36,7 +37,7 @@
this.btnGenerateAirplane = new System.Windows.Forms.Button();
this.labelCountEngines = new System.Windows.Forms.Label();
this.numericUpDownEngines = new System.Windows.Forms.NumericUpDown();
this.btnAddCountEngines = new System.Windows.Forms.Button();
this.btnAddTypeOfEngines = new System.Windows.Forms.Button();
this.buttonAddTypeOfEntity = new System.Windows.Forms.Button();
this.buttonDown = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
@ -51,8 +52,22 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// comboTypeEngines
//
this.comboTypeEngines.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.comboTypeEngines.FormattingEnabled = true;
this.comboTypeEngines.Items.AddRange(new object[] {
"Закругленный",
"Квадратный",
"Стрелка"});
this.comboTypeEngines.Location = new System.Drawing.Point(17, 155);
this.comboTypeEngines.Name = "comboTypeEngines";
this.comboTypeEngines.Size = new System.Drawing.Size(175, 23);
this.comboTypeEngines.TabIndex = 9;
//
// groupBoxTools
//
this.groupBoxTools.Controls.Add(this.comboTypeEngines);
this.groupBoxTools.Controls.Add(this.labelSpeed);
this.groupBoxTools.Controls.Add(this.numericSpeed);
this.groupBoxTools.Controls.Add(this.labelWeight);
@ -60,7 +75,7 @@
this.groupBoxTools.Controls.Add(this.btnGenerateAirplane);
this.groupBoxTools.Controls.Add(this.labelCountEngines);
this.groupBoxTools.Controls.Add(this.numericUpDownEngines);
this.groupBoxTools.Controls.Add(this.btnAddCountEngines);
this.groupBoxTools.Controls.Add(this.btnAddTypeOfEngines);
this.groupBoxTools.Controls.Add(this.buttonAddTypeOfEntity);
this.groupBoxTools.Controls.Add(this.buttonDown);
this.groupBoxTools.Controls.Add(this.buttonRight);
@ -109,7 +124,7 @@
//
// btnGenerateAirplane
//
this.btnGenerateAirplane.Location = new System.Drawing.Point(17, 233);
this.btnGenerateAirplane.Location = new System.Drawing.Point(17, 263);
this.btnGenerateAirplane.Name = "btnGenerateAirplane";
this.btnGenerateAirplane.Size = new System.Drawing.Size(175, 23);
this.btnGenerateAirplane.TabIndex = 15;
@ -120,7 +135,7 @@
// labelCountEngines
//
this.labelCountEngines.AutoSize = true;
this.labelCountEngines.Location = new System.Drawing.Point(17, 157);
this.labelCountEngines.Location = new System.Drawing.Point(17, 187);
this.labelCountEngines.Name = "labelCountEngines";
this.labelCountEngines.Size = new System.Drawing.Size(113, 15);
this.labelCountEngines.TabIndex = 14;
@ -128,20 +143,20 @@
//
// numericUpDownEngines
//
this.numericUpDownEngines.Location = new System.Drawing.Point(136, 155);
this.numericUpDownEngines.Location = new System.Drawing.Point(136, 185);
this.numericUpDownEngines.Name = "numericUpDownEngines";
this.numericUpDownEngines.Size = new System.Drawing.Size(56, 23);
this.numericUpDownEngines.TabIndex = 13;
//
// btnAddCountEngines
// btnAddTypeOfEngines
//
this.btnAddCountEngines.Location = new System.Drawing.Point(17, 184);
this.btnAddCountEngines.Name = "btnAddCountEngines";
this.btnAddCountEngines.Size = new System.Drawing.Size(175, 43);
this.btnAddCountEngines.TabIndex = 12;
this.btnAddCountEngines.Text = "Добавить кол-во двигателей для генерации";
this.btnAddCountEngines.UseVisualStyleBackColor = true;
this.btnAddCountEngines.Click += new System.EventHandler(this.btnAddCountEngines_Click);
this.btnAddTypeOfEngines.Location = new System.Drawing.Point(17, 214);
this.btnAddTypeOfEngines.Name = "btnAddTypeOfEngines";
this.btnAddTypeOfEngines.Size = new System.Drawing.Size(175, 43);
this.btnAddTypeOfEngines.TabIndex = 12;
this.btnAddTypeOfEngines.Text = "Добавить тип двигателя и их кол-во для генерации";
this.btnAddTypeOfEngines.UseVisualStyleBackColor = true;
this.btnAddTypeOfEngines.Click += new System.EventHandler(this.btnAddTypeOfEngines_Click);
//
// buttonAddTypeOfEntity
//
@ -240,6 +255,7 @@
#endregion
private ComboBox comboTypeEngines;
private GroupBox groupBoxTools;
private PictureBox pictureBox;
private ComboBox comboBoxSelectorMap;
@ -247,7 +263,7 @@
private Button buttonRight;
private Button buttonLeft;
private Button buttonUp;
private Button btnAddCountEngines;
private Button btnAddTypeOfEngines;
private Button buttonAddTypeOfEntity;
private Label labelCountEngines;
private NumericUpDown numericUpDownEngines;

View File

@ -109,11 +109,23 @@
}
}
private void btnAddCountEngines_Click(object sender, EventArgs e)
private void btnAddTypeOfEngines_Click(object sender, EventArgs e)
{
IAirplaneEngines engines = new DrawningAirplaneEngines();
engines.CountEngines = (int)numericUpDownEngines.Value;
_generatorAirplane.AddTypeOfEngines(engines);
IAirplaneEngines? typeAirplaneEngines = null;
switch (comboTypeEngines.Text)
{
case "Квадратный":
typeAirplaneEngines = new AirplaneRectEngines();
break;
case "Стрелка":
typeAirplaneEngines = new AirplaneArrowEngines();
break;
default:
typeAirplaneEngines = new DrawningAirplaneEngines();
break;
}
typeAirplaneEngines.CountEngines = (int)numericUpDownEngines.Value;
_generatorAirplane.AddTypeOfEngines(typeAirplaneEngines);
}
}
}