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] =?UTF-8?q?=C2=AB=D0=92=D0=B5=D1=81=D1=8C=20=D1=81=D0=B5?=
=?UTF-8?q?=D0=BA=D1=80=D0=B5=D1=82=20=D0=B7=D0=B0=D0=BA=D0=BB=D1=8E=D1=87?=
=?UTF-8?q?=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=B2=20=D1=82=D0=BE=D0=BC,?=
=?UTF-8?q?=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D1=81=D0=B1=D0=B8=D1=82?=
=?UTF-8?q?=D1=8C=20=D1=81=20=D1=82=D0=BE=D0=BB=D0=BA=D1=83=20=D0=B2=D1=80?=
=?UTF-8?q?=D0=B0=D0=B3=D0=B0,=20=D1=87=D1=82=D0=BE=D0=B1=D1=8B=20=D0=BE?=
=?UTF-8?q?=D0=BD=20=D0=BD=D0=B5=20=D1=81=D0=BC=D0=BE=D0=B3=20=D0=BF=D0=BE?=
=?UTF-8?q?=D0=BD=D1=8F=D1=82=D1=8C=20=D0=BD=D0=B0=D1=88=D0=B8=20=D0=BD?=
=?UTF-8?q?=D0=B0=D1=81=D1=82=D0=BE=D1=8F=D1=89=D0=B8=D0=B5=20=D0=BD=D0=B0?=
=?UTF-8?q?=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