PIbd-23_Nasyrov_A_G_Lab5 #7

Closed
gaillard wants to merge 7 commits from lab5 into lab4
9 changed files with 650 additions and 8 deletions

View File

@ -54,6 +54,12 @@ namespace ProjectAirplaneWithRadar.DrawningObjects
_startPosX = x;
_startPosY = y;
}
public void ChangeColor(Color col)
{
if (EntityAirplane == null)
return;
EntityAirplane.BodyColor = col;
}
public bool CanMove(Direction direction)
{
if (EntityAirplane == null)

View File

@ -20,6 +20,10 @@ namespace ProjectAirplaneWithRadar.DrawningObjects
EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, radar, dopbak);
}
}
public void ChangeAddColor(Color col)
{
((EntityAirplaneWithRadar)EntityAirplane).AdditionalColor = col;
}
public override void DrawTransport(Graphics g)
{
if (EntityAirplane is not EntityAirplaneWithRadar airplaneWithRadar)

View File

@ -11,7 +11,7 @@ namespace ProjectAirplaneWithRadar.Entities
{
public int Speed { get; private set; }
public double Weight { get; private set; }
public Color BodyColor { get; private set; }
public Color BodyColor { get; set; }
public double Step => (double)Speed * 100 / Weight;
public EntityAirplane(int speed, double weight, Color bodyColor)
{

View File

@ -9,7 +9,7 @@ namespace ProjectAirplaneWithRadar.Entities
{
public class EntityAirplaneWithRadar : EntityAirplane
{
public Color AdditionalColor { get; private set; }
public Color AdditionalColor { get; set; }
public bool Radar { get; private set; }
public bool DopBak { get; private set; }
public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak) : base(speed, weight, bodyColor)

View File

@ -0,0 +1,366 @@
namespace ProjectAirplaneWithRadar
{
partial class FormAirplaneConfig
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
configGroupBox = new GroupBox();
colorGroupBox = new GroupBox();
yellowPanel = new Panel();
bluePanel = new Panel();
greenPanel = new Panel();
purplePanel = new Panel();
blackPanel = new Panel();
greyPanel = new Panel();
whitePanel = new Panel();
redPanel = new Panel();
airplaneWithRadarLabel = new Label();
airplaneLabel = new Label();
checkDopBak = new CheckBox();
checkRadar = new CheckBox();
numericWeight = new NumericUpDown();
numericSpeed = new NumericUpDown();
weightLabel = new Label();
speedLabel = new Label();
allowPanel = new Panel();
addColorLabel = new Label();
pictureBox = new PictureBox();
colorLabel = new Label();
addButton = new Button();
cancelButton = new Button();
configGroupBox.SuspendLayout();
colorGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numericWeight).BeginInit();
((System.ComponentModel.ISupportInitialize)numericSpeed).BeginInit();
allowPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// configGroupBox
//
configGroupBox.Controls.Add(colorGroupBox);
configGroupBox.Controls.Add(airplaneWithRadarLabel);
configGroupBox.Controls.Add(airplaneLabel);
configGroupBox.Controls.Add(checkDopBak);
configGroupBox.Controls.Add(checkRadar);
configGroupBox.Controls.Add(numericWeight);
configGroupBox.Controls.Add(numericSpeed);
configGroupBox.Controls.Add(weightLabel);
configGroupBox.Controls.Add(speedLabel);
configGroupBox.Location = new Point(12, 12);
configGroupBox.Name = "configGroupBox";
configGroupBox.Size = new Size(511, 279);
configGroupBox.TabIndex = 0;
configGroupBox.TabStop = false;
configGroupBox.Text = "Параметры";
//
// colorGroupBox
//
colorGroupBox.Controls.Add(yellowPanel);
colorGroupBox.Controls.Add(bluePanel);
colorGroupBox.Controls.Add(greenPanel);
colorGroupBox.Controls.Add(purplePanel);
colorGroupBox.Controls.Add(blackPanel);
colorGroupBox.Controls.Add(greyPanel);
colorGroupBox.Controls.Add(whitePanel);
colorGroupBox.Controls.Add(redPanel);
colorGroupBox.Location = new Point(171, 23);
colorGroupBox.Name = "colorGroupBox";
colorGroupBox.Size = new Size(234, 143);
colorGroupBox.TabIndex = 7;
colorGroupBox.TabStop = false;
colorGroupBox.Text = "Цвета";
//
// yellowPanel
//
yellowPanel.AllowDrop = true;
yellowPanel.BackColor = Color.Yellow;
yellowPanel.Location = new Point(174, 27);
yellowPanel.Name = "yellowPanel";
yellowPanel.Size = new Size(50, 50);
yellowPanel.TabIndex = 3;
//
// bluePanel
//
bluePanel.AllowDrop = true;
bluePanel.BackColor = Color.Blue;
bluePanel.Location = new Point(118, 27);
bluePanel.Name = "bluePanel";
bluePanel.Size = new Size(50, 50);
bluePanel.TabIndex = 2;
//
// greenPanel
//
greenPanel.AllowDrop = true;
greenPanel.BackColor = Color.Green;
greenPanel.Location = new Point(62, 27);
greenPanel.Name = "greenPanel";
greenPanel.Size = new Size(50, 50);
greenPanel.TabIndex = 1;
//
// purplePanel
//
purplePanel.AllowDrop = true;
purplePanel.BackColor = Color.Purple;
purplePanel.Location = new Point(174, 82);
purplePanel.Name = "purplePanel";
purplePanel.Size = new Size(50, 50);
purplePanel.TabIndex = 3;
//
// blackPanel
//
blackPanel.AllowDrop = true;
blackPanel.BackColor = Color.Black;
blackPanel.Location = new Point(118, 83);
blackPanel.Name = "blackPanel";
blackPanel.Size = new Size(50, 50);
blackPanel.TabIndex = 2;
//
// greyPanel
//
greyPanel.AllowDrop = true;
greyPanel.BackColor = Color.Silver;
greyPanel.Location = new Point(62, 83);
greyPanel.Name = "greyPanel";
greyPanel.Size = new Size(50, 50);
greyPanel.TabIndex = 1;
//
// whitePanel
//
whitePanel.AllowDrop = true;
whitePanel.BackColor = Color.White;
whitePanel.Location = new Point(6, 83);
whitePanel.Name = "whitePanel";
whitePanel.Size = new Size(50, 50);
whitePanel.TabIndex = 1;
//
// redPanel
//
redPanel.AllowDrop = true;
redPanel.BackColor = Color.Red;
redPanel.Location = new Point(6, 27);
redPanel.Name = "redPanel";
redPanel.Size = new Size(50, 50);
redPanel.TabIndex = 0;
//
// airplaneWithRadarLabel
//
airplaneWithRadarLabel.BorderStyle = BorderStyle.FixedSingle;
airplaneWithRadarLabel.Location = new Point(297, 169);
airplaneWithRadarLabel.Name = "airplaneWithRadarLabel";
airplaneWithRadarLabel.Size = new Size(120, 50);
airplaneWithRadarLabel.TabIndex = 9;
airplaneWithRadarLabel.Text = "Продвинутый";
airplaneWithRadarLabel.TextAlign = ContentAlignment.MiddleCenter;
//
// airplaneLabel
//
airplaneLabel.BorderStyle = BorderStyle.FixedSingle;
airplaneLabel.Location = new Point(171, 169);
airplaneLabel.Name = "airplaneLabel";
airplaneLabel.Size = new Size(120, 50);
airplaneLabel.TabIndex = 8;
airplaneLabel.Text = "Простой";
airplaneLabel.TextAlign = ContentAlignment.MiddleCenter;
//
// checkDopBak
//
checkDopBak.AutoSize = true;
checkDopBak.Location = new Point(6, 162);
checkDopBak.Name = "checkDopBak";
checkDopBak.Size = new Size(159, 24);
checkDopBak.TabIndex = 5;
checkDopBak.Text = "наличие доп. бака";
checkDopBak.UseVisualStyleBackColor = true;
//
// checkRadar
//
checkRadar.AutoSize = true;
checkRadar.Location = new Point(6, 132);
checkRadar.Name = "checkRadar";
checkRadar.Size = new Size(144, 24);
checkRadar.TabIndex = 4;
checkRadar.Text = "наличие радара";
checkRadar.UseVisualStyleBackColor = true;
//
// numericWeight
//
numericWeight.Location = new Point(6, 99);
numericWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericWeight.Name = "numericWeight";
numericWeight.Size = new Size(150, 27);
numericWeight.TabIndex = 3;
numericWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// numericSpeed
//
numericSpeed.Location = new Point(6, 46);
numericSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
numericSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
numericSpeed.Name = "numericSpeed";
numericSpeed.Size = new Size(150, 27);
numericSpeed.TabIndex = 2;
numericSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
//
// weightLabel
//
weightLabel.AutoSize = true;
weightLabel.Location = new Point(6, 76);
weightLabel.Name = "weightLabel";
weightLabel.Size = new Size(33, 20);
weightLabel.TabIndex = 1;
weightLabel.Text = "Вес";
//
// speedLabel
//
speedLabel.AutoSize = true;
speedLabel.Location = new Point(6, 23);
speedLabel.Name = "speedLabel";
speedLabel.Size = new Size(73, 20);
speedLabel.TabIndex = 0;
speedLabel.Text = "Скорость";
//
// allowPanel
//
allowPanel.AllowDrop = true;
allowPanel.Controls.Add(addColorLabel);
allowPanel.Controls.Add(pictureBox);
allowPanel.Controls.Add(colorLabel);
allowPanel.Location = new Point(538, 12);
allowPanel.Name = "allowPanel";
allowPanel.Size = new Size(250, 247);
allowPanel.TabIndex = 1;
allowPanel.DragDrop += allowPanel_DragDrop;
allowPanel.DragEnter += allowPanel_DragEnter;
//
// addColorLabel
//
addColorLabel.AllowDrop = true;
addColorLabel.BorderStyle = BorderStyle.FixedSingle;
addColorLabel.Location = new Point(141, 10);
addColorLabel.Name = "addColorLabel";
addColorLabel.Size = new Size(104, 33);
addColorLabel.TabIndex = 2;
addColorLabel.Text = "Доп. цвет";
addColorLabel.TextAlign = ContentAlignment.MiddleCenter;
addColorLabel.DragDrop += addColorLabel_DragDrop;
addColorLabel.DragEnter += addColorLabel_DragEnter;
//
// pictureBox
//
pictureBox.Location = new Point(17, 50);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(218, 190);
pictureBox.TabIndex = 0;
pictureBox.TabStop = false;
//
// colorLabel
//
colorLabel.AllowDrop = true;
colorLabel.BorderStyle = BorderStyle.FixedSingle;
colorLabel.Location = new Point(17, 10);
colorLabel.Name = "colorLabel";
colorLabel.Size = new Size(104, 33);
colorLabel.TabIndex = 1;
colorLabel.Text = "Цвет";
colorLabel.TextAlign = ContentAlignment.MiddleCenter;
colorLabel.DragDrop += colorLabel_DragDrop;
colorLabel.DragEnter += colorLabel_DragEnter;
//
// addButton
//
addButton.Location = new Point(555, 262);
addButton.Name = "addButton";
addButton.Size = new Size(94, 29);
addButton.TabIndex = 2;
addButton.Text = "Добавить";
addButton.UseVisualStyleBackColor = true;
addButton.Click += addButton_Click;
//
// cancelButton
//
cancelButton.Location = new Point(679, 262);
cancelButton.Name = "cancelButton";
cancelButton.Size = new Size(94, 29);
cancelButton.TabIndex = 3;
cancelButton.Text = "Отменить";
cancelButton.UseVisualStyleBackColor = true;
//
// FormAirplaneConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 303);
Controls.Add(cancelButton);
Controls.Add(addButton);
Controls.Add(allowPanel);
Controls.Add(configGroupBox);
Name = "FormAirplaneConfig";
Text = "FormAirplaneConfig";
configGroupBox.ResumeLayout(false);
configGroupBox.PerformLayout();
colorGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)numericWeight).EndInit();
((System.ComponentModel.ISupportInitialize)numericSpeed).EndInit();
allowPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox configGroupBox;
private CheckBox checkRadar;
private NumericUpDown numericWeight;
private NumericUpDown numericSpeed;
private Label weightLabel;
private Label speedLabel;
private CheckBox checkDopBak;
private GroupBox colorGroupBox;
private Panel panel5;
private Panel panel4;
private Panel panel3;
private Panel panel2;
private Panel redPanel;
private Panel purplePanel;
private Panel blackPanel;
private Panel greyPanel;
private Panel whitePanel;
private Label airplaneWithRadarLabel;
private Label airplaneLabel;
private Panel yellowPanel;
private Panel bluePanel;
private Panel greenPanel;
private Panel allowPanel;
private PictureBox pictureBox;
private Label addColorLabel;
private Label colorLabel;
private Button addButton;
private Button cancelButton;
}
}

View File

@ -0,0 +1,137 @@
using ProjectAirplaneWithRadar.DrawningObjects;
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 ProjectAirplaneWithRadar
{
public partial class FormAirplaneConfig : Form
{
DrawningAirplane? _airplane = null;
Action<DrawningAirplane>? EventAddAirplane;
private readonly int PictureWidth;
private readonly int PictureHeight;
public void AddEvent(Action<DrawningAirplane>? ev)
{
if (EventAddAirplane == null)
{
EventAddAirplane = ev;
}
else
{
EventAddAirplane += ev;
}
}
public FormAirplaneConfig(int width, int height)
{
InitializeComponent();
blackPanel.MouseDown += PanelColor_MouseDown;
greenPanel.MouseDown += PanelColor_MouseDown;
redPanel.MouseDown += PanelColor_MouseDown;
bluePanel.MouseDown += PanelColor_MouseDown;
greyPanel.MouseDown += PanelColor_MouseDown;
yellowPanel.MouseDown += PanelColor_MouseDown;
purplePanel.MouseDown += PanelColor_MouseDown;
whitePanel.MouseDown += PanelColor_MouseDown;
airplaneLabel.MouseDown += LabelObject_MouseDown;
airplaneWithRadarLabel.MouseDown += LabelObject_MouseDown;
cancelButton.Click += (s, e) => Close();
PictureWidth = width;
PictureHeight = height;
}
public void DrawAirplane()
{
Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics gr = Graphics.FromImage(bmp);
_airplane?.SetPosition(5, 5);
_airplane?.DrawTransport(gr);
pictureBox.Image = bmp;
}
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
private void allowPanel_DragDrop(object sender, DragEventArgs e)
{
switch (e.Data?.GetData(DataFormats.Text).ToString())
{
case "airplaneLabel":
_airplane = new DrawningAirplane((int)numericSpeed.Value,
(int)numericWeight.Value, Color.Silver, PictureWidth, PictureHeight);
break;
case "airplaneWithRadarLabel":
_airplane = new DrawningAirplaneWithRadar((int)numericSpeed.Value,
(int)numericWeight.Value, Color.Silver, Color.Black, checkRadar.Checked, checkDopBak.Checked, PictureWidth, PictureHeight);
break;
}
colorLabel.BackColor = Color.Empty;
addColorLabel.BackColor = Color.Empty;
DrawAirplane();
}
private void allowPanel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void addButton_Click(object sender, EventArgs e)
{
EventAddAirplane?.Invoke(_airplane);
Close();
}
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
{
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
}
private void colorLabel_DragDrop(object sender, DragEventArgs e)
{
if (_airplane == null)
return;
colorLabel.BackColor = (Color)e.Data.GetData(typeof(Color));
_airplane.ChangeColor(colorLabel.BackColor);
DrawAirplane();
}
private void colorLabel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void addColorLabel_DragDrop(object sender, DragEventArgs e)
{
if ((_airplane == null) || (_airplane is DrawningAirplaneWithRadar == false))
return;
addColorLabel.BackColor = (Color)e.Data.GetData(typeof(Color));
((DrawningAirplaneWithRadar)_airplane).ChangeAddColor(addColorLabel.BackColor);
DrawAirplane();
}
private void addColorLabel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
Review

Логика DragEnter основного цвета идентична логике DragEnter дополнительного цвета и отдельная обработка тут не нужна

Логика DragEnter основного цвета идентична логике DragEnter дополнительного цвета и отдельная обработка тут не нужна
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}
}
}

View File

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

View File

@ -52,6 +52,7 @@
pictureBoxAirplanesCollection.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxAirplanesCollection.TabIndex = 0;
pictureBoxAirplanesCollection.TabStop = false;
pictureBoxAirplanesCollection.Click += pictureBoxAirplanesCollection_Click;
//
// groupBoxAirplaneWithRadar
//

View File

@ -1,6 +1,7 @@
using ProjectAirplaneWithRadar.DrawningObjects;
using ProjectAirplaneWithRadar.MovementStrategy;
using ProjectAirplaneWithRadar.Generics;
using System.Diagnostics.Metrics;
namespace ProjectAirplaneWithRadar
{
@ -44,10 +45,11 @@ namespace ProjectAirplaneWithRadar
{
return;
}
FormAirplaneWithRadar form = new();
if (form.ShowDialog() == DialogResult.OK)
{
if (obj + form.SelectedAirplane)
FormAirplaneConfig form = new(pictureBoxAirplanesCollection.Width, pictureBoxAirplanesCollection.Height);
form.Show();
Action < DrawningAirplane >? airplaneDelegate = new((m) => {
bool q = (obj + m);
if (q)
{
MessageBox.Show("Îáúåêò äîáàâëåí");
pictureBoxAirplanesCollection.Image = obj.ShowAirplanes();
@ -56,7 +58,8 @@ namespace ProjectAirplaneWithRadar
{
MessageBox.Show("Íå óäàëîñü äîáàâèòü îáúåêò");
}
}
});
form.AddEvent(airplaneDelegate);
}
private void buttonDeleteAirplane_Click(object sender, EventArgs e)
{
@ -128,7 +131,12 @@ namespace ProjectAirplaneWithRadar
}
private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e)
{
pictureBoxAirplanesCollection.Image =_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowAirplanes();
pictureBoxAirplanesCollection.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowAirplanes();
}
private void pictureBoxAirplanesCollection_Click(object sender, EventArgs e)
{
}
}
}