hard reboot

This commit is contained in:
antoc0der 2023-11-10 08:26:12 +03:00
parent 633083e5de
commit 8daf34e524
3 changed files with 14 additions and 27 deletions

View File

@ -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);
}

View File

@ -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<DrawningAirplane>? EventAddAirplane;
private readonly int PictureWidth;
private readonly int PictureHeight;
public void AddEvent(Action<DrawningAirplane>? 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();
}

View File

@ -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)
{