Pyatakov K.M. LabWork5 #7

Closed
ker73rus wants to merge 5 commits from LabWork5 into LabWork4
3 changed files with 7 additions and 17 deletions
Showing only changes of commit 577de84cd5 - Show all commits

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

View File

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