изменено по использование встроенного делегата
This commit is contained in:
parent
0d7e4052f5
commit
6b9a17243f
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user