LabWork05

This commit is contained in:
Osyagina_Anna 2024-04-18 09:46:19 +04:00
parent e3166e83ef
commit b2124bf15a

View File

@ -16,7 +16,7 @@ namespace ProjectMotorboat
{ {
private DrawningBoat? _boat; private DrawningBoat? _boat;
private event BoatDelegate? BoatDelegate; private event Action<DrawningBoat>? BoatDelegate;
public FormBoatConfig() public FormBoatConfig()
{ {
InitializeComponent(); InitializeComponent();
@ -32,9 +32,16 @@ namespace ProjectMotorboat
buttonCancel.Click += (sender, e) => Close(); buttonCancel.Click += (sender, e) => Close();
} }
public void AddEvent(BoatDelegate boatDelegate) public void AddEvent(Action<DrawningBoat> boatDelegate)
{ {
BoatDelegate += boatDelegate; if (BoatDelegate != null)
{
BoatDelegate = boatDelegate;
}
else
{
BoatDelegate += boatDelegate;
}
} }
private void DrawObject() private void DrawObject()