From 080c6c4c23ddba5cc535386704c246b409288257 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Tue, 7 Nov 2023 20:48:35 +0300
Subject: [PATCH 1/7] =?UTF-8?q?=C2=AB=D0=92=D0=B5=D1=81=D1=8C=20=D1=81?=
=?UTF-8?q?=D0=B5=D0=BA=D1=80=D0=B5=D1=82=20=D0=B7=D0=B0=D0=BA=D0=BB=D1=8E?=
=?UTF-8?q?=D1=87=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=B2=20=D1=82=D0=BE?=
=?UTF-8?q?=D0=BC,=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D1=81=D0=B1=D0=B8?=
=?UTF-8?q?=D1=82=D1=8C=20=D1=81=20=D1=82=D0=BE=D0=BB=D0=BA=D1=83=20=D0=B2?=
=?UTF-8?q?=D1=80=D0=B0=D0=B3=D0=B0,=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20?=
=?UTF-8?q?=D0=BE=D0=BD=20=D0=BD=D0=B5=20=D1=81=D0=BC=D0=BE=D0=B3=20=D0=BF?=
=?UTF-8?q?=D0=BE=D0=BD=D1=8F=D1=82=D1=8C=20=D0=BD=D0=B0=D1=88=D0=B8=20?=
=?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D0=BE=D1=8F=D1=89=D0=B8=D0=B5=20=D0=BD?=
=?UTF-8?q?=D0=B0=D0=BC=D0=B5=D1=80=D0=B5=D0=BD=D0=B8=D1=8F=C2=BB.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FormAirplaneConfig.Designer.cs | 366 ++++++++++++++++++
.../FormAirplaneConfig.cs | 155 ++++++++
.../FormAirplaneConfig.resx | 120 ++++++
3 files changed, 641 insertions(+)
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.resx
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs
new file mode 100644
index 0000000..0163aab
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs
@@ -0,0 +1,366 @@
+namespace ProjectAirplaneWithRadar
+{
+ partial class FormAirplaneConfig
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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;
+ //
+ // FormMonorailConfig
+ //
+ 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 = "FormMonorailConfig";
+ Text = "FormMonorailConfig";
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
new file mode 100644
index 0000000..f350074
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
@@ -0,0 +1,155 @@
+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;
+
+ private event AirplaneDelegate? EventAddAirplane;
+
+ DrawningAirplane SelectedAirplane(DrawningAirplane фшкздфту)
+ {
+ return _airplane;
+ }
+
+ public void AddEvent(AirplaneDelegate ev)
+ {
+ if (EventAddAirplane == null)
+ {
+ EventAddAirplane = ev;
+ }
+ else
+ {
+ EventAddAirplane += ev;
+ }
+ }
+
+ public FormAirplaneConfig()
+ {
+ 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();
+ }
+
+ 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.White, Color.Silver, Color.Black, pictureBox.Width,
+ pictureBox.Height);
+ break;
+ case "airplaneWithRadarLabel":
+ _airplane = new DrawningAirplaneWithRadar((int)numericSpeed.Value,
+ (int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width,
+ pictureBox.Height, 4, Color.Silver, checkRadar.Checked, checkDopBak.Checked);
+ 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)))
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
--
2.25.1
From e86d1515d983a6eeda1b536c164e1ab19de68cbf Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Tue, 7 Nov 2023 21:16:17 +0300
Subject: [PATCH 2/7] =?UTF-8?q?=E2=80=9E=D0=91=D0=B5=D0=B4=D1=8B=20=D0=BF?=
=?UTF-8?q?=D1=80=D0=B8=D1=85=D0=BE=D0=B4=D1=8F=D1=82=20=D1=82=D0=BE=D0=B3?=
=?UTF-8?q?=D0=B4=D0=B0,=20=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20=D0=BB=D1=8E?=
=?UTF-8?q?=D0=B4=D0=B8=20=D0=B2=20=D1=81=D0=B2=D0=BE=D0=B5=D0=B9=20=D0=BB?=
=?UTF-8?q?=D0=B5=D0=BD=D0=B8=20=D0=B7=D0=B0=D0=B1=D1=8B=D0=B2=D0=B0=D1=8E?=
=?UTF-8?q?=D1=82=20=D0=B7=D0=B0=D0=B1=D0=BE=D1=82=D0=B8=D1=82=D1=8C=D1=81?=
=?UTF-8?q?=D1=8F=20=D0=BE=20=D1=81=D0=B5=D0=B1=D0=B5.=E2=80=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ProjectAirplaneWithRadar/DrawningAirplane.cs | 6 ++++++
.../DrawningAirplaneWithRadar.cs | 4 ++++
.../ProjectAirplaneWithRadar/EntityAirplane.cs | 2 +-
.../EntityAirplaneWithRadar.cs | 2 +-
.../ProjectAirplaneWithRadar/FormAirplaneConfig.cs | 6 +++---
.../ProjectAirplaneWithRadar/MonorailDelegate.cs | 12 ++++++++++++
6 files changed, 27 insertions(+), 5 deletions(-)
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/MonorailDelegate.cs
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplane.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplane.cs
index 77977e8..9e38a76 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplane.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplane.cs
@@ -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)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
index c0b9176..92df033 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
@@ -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)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplane.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplane.cs
index 0ace7d2..e3f1787 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplane.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplane.cs
@@ -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)
{
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
index 28e36f1..dc93954 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
@@ -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)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
index f350074..9b47ff3 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
@@ -70,13 +70,13 @@ namespace ProjectAirplaneWithRadar
{
case "airplaneLabel":
_airplane = new DrawningAirplane((int)numericSpeed.Value,
- (int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width,
+ (int)numericWeight.Value, Color.Silver, pictureBox.Width,
pictureBox.Height);
break;
case "airplaneWithRadarLabel":
_airplane = new DrawningAirplaneWithRadar((int)numericSpeed.Value,
- (int)numericWeight.Value, Color.White, Color.Silver, Color.Black, pictureBox.Width,
- pictureBox.Height, 4, Color.Silver, checkRadar.Checked, checkDopBak.Checked);
+ (int)numericWeight.Value, Color.Silver, Color.Black, checkRadar.Checked, checkDopBak.Checked, pictureBox.Width,
+ pictureBox.Height);
break;
}
colorLabel.BackColor = Color.Empty;
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/MonorailDelegate.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/MonorailDelegate.cs
new file mode 100644
index 0000000..30a98d8
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/MonorailDelegate.cs
@@ -0,0 +1,12 @@
+using ProjectAirplaneWithRadar.DrawningObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public delegate void AirplaneDelegate(DrawningAirplane airplane);
+
+}
--
2.25.1
From 0df7ae5e02483ce621b28e1cc23652581015a299 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Tue, 7 Nov 2023 22:16:15 +0300
Subject: [PATCH 3/7] =?UTF-8?q?=E2=80=9E=D0=9D=D0=B5=D0=BF=D0=BE=D0=B1?=
=?UTF-8?q?=D0=B5=D0=B4=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D1=8C=20=D0=B7=D0=B0?=
=?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B0=20=D0=B2=20=D1=81?=
=?UTF-8?q?=D0=B5=D0=B1=D0=B5=20=D1=81=D0=B0=D0=BC=D0=BE=D0=BC,=20=D0=B2?=
=?UTF-8?q?=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20?=
=?UTF-8?q?=D0=BF=D0=BE=D0=B1=D0=B5=D0=B4=D1=8B=20=D0=B7=D0=B0=D0=BA=D0=BB?=
=?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B0=20=D0=B2=20=D0=BF=D1=80=D0=BE?=
=?UTF-8?q?=D1=82=D0=B8=D0=B2=D0=BD=D0=B8=D0=BA=D0=B5.=E2=80=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FormAirplanesCollection.Designer.cs | 1 +
.../FormAirplanesCollection.cs | 20 +++++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.Designer.cs
index 47c5322..21b5bdb 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.Designer.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.Designer.cs
@@ -52,6 +52,7 @@
pictureBoxAirplanesCollection.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxAirplanesCollection.TabIndex = 0;
pictureBoxAirplanesCollection.TabStop = false;
+ pictureBoxAirplanesCollection.Click += pictureBoxAirplanesCollection_Click;
//
// groupBoxAirplaneWithRadar
//
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs
index f2ec634..65cfadc 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs
@@ -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();
+ form.Show();
+ AirplaneDelegate? 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)
+ {
+
}
}
}
\ No newline at end of file
--
2.25.1
From 633083e5de8de8564c724a1b4782d6cd83278f95 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Fri, 10 Nov 2023 07:50:47 +0300
Subject: [PATCH 4/7] yeah baby
---
.../{MonorailDelegate.cs => AirplaneDelegate.cs} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{MonorailDelegate.cs => AirplaneDelegate.cs} (100%)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/MonorailDelegate.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/AirplaneDelegate.cs
similarity index 100%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/MonorailDelegate.cs
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/AirplaneDelegate.cs
--
2.25.1
From 8daf34e5241f91415ad47831b8ecc6ef521ce48b Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Fri, 10 Nov 2023 08:26:12 +0300
Subject: [PATCH 5/7] hard reboot
---
.../AirplaneDelegate.cs | 12 ---------
.../FormAirplaneConfig.cs | 25 +++++++++----------
.../FormAirplanesCollection.cs | 4 +--
3 files changed, 14 insertions(+), 27 deletions(-)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/AirplaneDelegate.cs
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/AirplaneDelegate.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/AirplaneDelegate.cs
deleted file mode 100644
index 30a98d8..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/AirplaneDelegate.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using ProjectAirplaneWithRadar.DrawningObjects;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public delegate void AirplaneDelegate(DrawningAirplane airplane);
-
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
index 9b47ff3..1859eda 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
@@ -9,20 +9,18 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+
namespace ProjectAirplaneWithRadar
{
public partial class FormAirplaneConfig : Form
{
DrawningAirplane? _airplane = null;
- private event AirplaneDelegate? EventAddAirplane;
-
- DrawningAirplane SelectedAirplane(DrawningAirplane фшкздфту)
- {
- return _airplane;
- }
-
- public void AddEvent(AirplaneDelegate ev)
+ Action? EventAddAirplane;
+ private readonly int PictureWidth;
+ private readonly int PictureHeight;
+
+ public void AddEvent(Action? ev)
{
if (EventAddAirplane == null)
{
@@ -34,7 +32,7 @@ namespace ProjectAirplaneWithRadar
}
}
- public FormAirplaneConfig()
+ public FormAirplaneConfig( int width, int height)
{
InitializeComponent();
blackPanel.MouseDown += PanelColor_MouseDown;
@@ -48,6 +46,8 @@ namespace ProjectAirplaneWithRadar
airplaneLabel.MouseDown += LabelObject_MouseDown;
airplaneWithRadarLabel.MouseDown += LabelObject_MouseDown;
cancelButton.Click += (s, e) => Close();
+ PictureWidth = width;
+ PictureHeight = height;
}
public void DrawAirplane()
@@ -70,13 +70,11 @@ namespace ProjectAirplaneWithRadar
{
case "airplaneLabel":
_airplane = new DrawningAirplane((int)numericSpeed.Value,
- (int)numericWeight.Value, Color.Silver, pictureBox.Width,
- pictureBox.Height);
+ (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, pictureBox.Width,
- pictureBox.Height);
+ (int)numericWeight.Value, Color.Silver, Color.Black, checkRadar.Checked, checkDopBak.Checked, PictureWidth, PictureHeight);
break;
}
colorLabel.BackColor = Color.Empty;
@@ -100,6 +98,7 @@ namespace ProjectAirplaneWithRadar
private void addButton_Click(object sender, EventArgs e)
{
+ //_airplane?.SetPosition(5, 5);
EventAddAirplane?.Invoke(_airplane);
Close();
}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs
index 65cfadc..a3ea417 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplanesCollection.cs
@@ -45,9 +45,9 @@ namespace ProjectAirplaneWithRadar
{
return;
}
- FormAirplaneConfig form = new();
+ FormAirplaneConfig form = new(pictureBoxAirplanesCollection.Width, pictureBoxAirplanesCollection.Height);
form.Show();
- AirplaneDelegate? airplaneDelegate = new((m) => {
+ Action < DrawningAirplane >? airplaneDelegate = new((m) => {
bool q = (obj + m);
if (q)
{
--
2.25.1
From 9d313781bae0fe0d2dc96277763b3c3a5461ae87 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Fri, 10 Nov 2023 09:53:38 +0300
Subject: [PATCH 6/7] norm
---
.../FormAirplaneConfig.Designer.cs | 8 ++++----
.../ProjectAirplaneWithRadar/FormAirplaneConfig.cs | 10 ++++------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs
index 0163aab..c45a8c4 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.Designer.cs
@@ -58,7 +58,7 @@
((System.ComponentModel.ISupportInitialize)numericSpeed).BeginInit();
allowPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
- //SuspendLayout();
+ SuspendLayout();
//
// configGroupBox
//
@@ -311,7 +311,7 @@
cancelButton.Text = "Отменить";
cancelButton.UseVisualStyleBackColor = true;
//
- // FormMonorailConfig
+ // FormAirplaneConfig
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
@@ -320,8 +320,8 @@
Controls.Add(addButton);
Controls.Add(allowPanel);
Controls.Add(configGroupBox);
- Name = "FormMonorailConfig";
- Text = "FormMonorailConfig";
+ Name = "FormAirplaneConfig";
+ Text = "FormAirplaneConfig";
configGroupBox.ResumeLayout(false);
configGroupBox.PerformLayout();
colorGroupBox.ResumeLayout(false);
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
index 1859eda..6518012 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
@@ -17,9 +17,9 @@ namespace ProjectAirplaneWithRadar
DrawningAirplane? _airplane = null;
Action? EventAddAirplane;
- private readonly int PictureWidth;
+ private readonly int PictureWidth;
private readonly int PictureHeight;
-
+
public void AddEvent(Action? ev)
{
if (EventAddAirplane == null)
@@ -32,7 +32,7 @@ namespace ProjectAirplaneWithRadar
}
}
- public FormAirplaneConfig( int width, int height)
+ public FormAirplaneConfig(int width, int height)
{
InitializeComponent();
blackPanel.MouseDown += PanelColor_MouseDown;
@@ -61,7 +61,7 @@ namespace ProjectAirplaneWithRadar
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
{
- (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,DragDropEffects.Move | DragDropEffects.Copy);
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
}
private void allowPanel_DragDrop(object sender, DragEventArgs e)
@@ -98,7 +98,6 @@ namespace ProjectAirplaneWithRadar
private void addButton_Click(object sender, EventArgs e)
{
- //_airplane?.SetPosition(5, 5);
EventAddAirplane?.Invoke(_airplane);
Close();
}
@@ -108,7 +107,6 @@ namespace ProjectAirplaneWithRadar
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
}
-
private void colorLabel_DragDrop(object sender, DragEventArgs e)
{
if (_airplane == null)
--
2.25.1
From 6d0a86275c9478ad7ad21e04b8c9bed9a5824b3e Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 13 Nov 2023 21:01:50 +0300
Subject: [PATCH 7/7] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BF?=
=?UTF-8?q?=D1=80=D0=BE=D0=B1=D0=B5=D0=BB=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FormAirplaneConfig.cs | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
index 6518012..2f4da10 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneConfig.cs
@@ -15,11 +15,9 @@ namespace ProjectAirplaneWithRadar
public partial class FormAirplaneConfig : Form
{
DrawningAirplane? _airplane = null;
-
Action? EventAddAirplane;
private readonly int PictureWidth;
private readonly int PictureHeight;
-
public void AddEvent(Action? ev)
{
if (EventAddAirplane == null)
@@ -31,7 +29,6 @@ namespace ProjectAirplaneWithRadar
EventAddAirplane += ev;
}
}
-
public FormAirplaneConfig(int width, int height)
{
InitializeComponent();
@@ -49,7 +46,6 @@ namespace ProjectAirplaneWithRadar
PictureWidth = width;
PictureHeight = height;
}
-
public void DrawAirplane()
{
Bitmap bmp = new Bitmap(pictureBox.Width, pictureBox.Height);
@@ -58,12 +54,10 @@ namespace ProjectAirplaneWithRadar
_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())
@@ -80,9 +74,7 @@ namespace ProjectAirplaneWithRadar
colorLabel.BackColor = Color.Empty;
addColorLabel.BackColor = Color.Empty;
DrawAirplane();
-
}
-
private void allowPanel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
@@ -93,20 +85,16 @@ namespace ProjectAirplaneWithRadar
{
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)
@@ -115,7 +103,6 @@ namespace ProjectAirplaneWithRadar
_airplane.ChangeColor(colorLabel.BackColor);
DrawAirplane();
}
-
private void colorLabel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
@@ -127,7 +114,6 @@ namespace ProjectAirplaneWithRadar
e.Effect = DragDropEffects.None;
}
}
-
private void addColorLabel_DragDrop(object sender, DragEventArgs e)
{
if ((_airplane == null) || (_airplane is DrawningAirplaneWithRadar == false))
@@ -136,7 +122,6 @@ namespace ProjectAirplaneWithRadar
((DrawningAirplaneWithRadar)_airplane).ChangeAddColor(addColorLabel.BackColor);
DrawAirplane();
}
-
private void addColorLabel_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(typeof(Color)))
--
2.25.1