Pyatakov K.M. LabWork5 #7
@ -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);
|
||||
}
|
@ -13,7 +13,7 @@ namespace Stormtrooper
|
||||
public partial class FormAirConfig : Form
|
||||
{
|
||||
DrawningMilitaryAirplane _airplane = null;
|
||||
private event AirDelegate EventAddAirplane;
|
||||
private event Action<DrawningMilitaryAirplane> EventAddAirplane;
|
||||
public FormAirConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -36,11 +36,11 @@ namespace Stormtrooper
|
||||
_airplane?.DrawAirplane(gr);
|
||||
pictureBoxShow.Image = bmp;
|
||||
}
|
||||
public void AddEvent(AirDelegate ev)
|
||||
public void AddEvent(Action<DrawningMilitaryAirplane> ev)
|
||||
{
|
||||
if (EventAddAirplane == null)
|
||||
{
|
||||
EventAddAirplane = new AirDelegate(ev);
|
||||
EventAddAirplane = new Action<DrawningMilitaryAirplane>(ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -79,11 +79,11 @@ namespace Stormtrooper
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var formLocomotiveConfig = new FormAirConfig();
|
||||
formLocomotiveConfig.AddEvent(AddLocomotive);
|
||||
formLocomotiveConfig.Show();
|
||||
var formAirConfig = new FormAirConfig();
|
||||
formAirConfig.AddEvent(AddAirplane);
|
||||
formAirConfig.Show();
|
||||
}
|
||||
private void AddLocomotive(DrawningMilitaryAirplane drawningMilitaryAirplane)
|
||||
private void AddAirplane(DrawningMilitaryAirplane drawningMilitaryAirplane)
|
||||
{
|
||||
if (listBoxMap.SelectedIndex == -1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user