Исправление неточностей

This commit is contained in:
foxkerik6 2022-11-29 02:11:15 +04:00
parent f3d2973c84
commit 577de84cd5
3 changed files with 7 additions and 17 deletions

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Stormtrooper
{
public delegate void AirDelegate(DrawningMilitaryAirplane airplane);
}

View File

@ -13,7 +13,7 @@ namespace Stormtrooper
public partial class FormAirConfig : Form public partial class FormAirConfig : Form
{ {
DrawningMilitaryAirplane _airplane = null; DrawningMilitaryAirplane _airplane = null;
private event AirDelegate EventAddAirplane; private event Action<DrawningMilitaryAirplane> EventAddAirplane;
public FormAirConfig() public FormAirConfig()
{ {
InitializeComponent(); InitializeComponent();
@ -36,11 +36,11 @@ namespace Stormtrooper
_airplane?.DrawAirplane(gr); _airplane?.DrawAirplane(gr);
pictureBoxShow.Image = bmp; pictureBoxShow.Image = bmp;
} }
public void AddEvent(AirDelegate ev) public void AddEvent(Action<DrawningMilitaryAirplane> ev)
{ {
if (EventAddAirplane == null) if (EventAddAirplane == null)
{ {
EventAddAirplane = new AirDelegate(ev); EventAddAirplane = new Action<DrawningMilitaryAirplane>(ev);
} }
else else
{ {

View File

@ -79,11 +79,11 @@ namespace Stormtrooper
/// <param name="e"></param> /// <param name="e"></param>
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
{ {
var formLocomotiveConfig = new FormAirConfig(); var formAirConfig = new FormAirConfig();
formLocomotiveConfig.AddEvent(AddLocomotive); formAirConfig.AddEvent(AddAirplane);
formLocomotiveConfig.Show(); formAirConfig.Show();
} }
private void AddLocomotive(DrawningMilitaryAirplane drawningMilitaryAirplane) private void AddAirplane(DrawningMilitaryAirplane drawningMilitaryAirplane)
{ {
if (listBoxMap.SelectedIndex == -1) if (listBoxMap.SelectedIndex == -1)
{ {