PI-13 Kobin V.O. LabWork06 Simple #6

Closed
vkobi wants to merge 2 commits from LabWork06 into LabWork05
2 changed files with 6 additions and 4 deletions
Showing only changes of commit c241b589f3 - Show all commits

View File

@ -44,6 +44,10 @@ public partial class FormLocomotiveCollection : Form
/// <param name="e"></param>
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
{
if(_company == null)
{
return;
}
FormLocomotiveConfig form = new();
// TODO передать метод
form.AddEvent(SetLocomotive);

View File

@ -16,7 +16,7 @@ public partial class FormLocomotiveConfig : Form
/// <summary>
/// Событие для передачи объекта
/// </summary>
private event LocomotiveDelegate? LocomotiveDelegate;
private event Action<DrawningLocomotive>? LocomotiveDelegate;
/// <summary>
/// Конструктор
@ -34,15 +34,13 @@ public partial class FormLocomotiveConfig : Form
panelBlue.MouseDown += Panel_MouseDown;
buttonCancel.Click += (events, e) => Close();
}
/// <summary>
/// Привязка внешнего метода к событию
/// </summary>
/// <param name="locomotiveDelegate"></param>
public void AddEvent(LocomotiveDelegate locomotiveDelegate)
public void AddEvent(Action<DrawningLocomotive> locomotiveDelegate)
{
LocomotiveDelegate += locomotiveDelegate;
}