PIbd_13 Klykov_N.V. LabWork05 Simple #7
@ -1,10 +0,0 @@
|
||||
using Excavator.Drawnings;
|
||||
|
||||
namespace Excavator;
|
||||
|
||||
/// <summary>
|
||||
/// Делегат передачи объекта класса-прорисовки
|
||||
/// </summary>
|
||||
/// <param name="excavator"></param>
|
||||
public delegate void ExcavatorDelegate(DrawningSimpleExcavator excavator);
|
||||
|
@ -35,7 +35,7 @@ public partial class FormExcavatorCollection : Form
|
||||
return;
|
||||
}
|
||||
FormExcavatorConfig form = new();
|
||||
form.ExcavatorDelegate += SetExcavator;
|
||||
form._excavatorDelegate += SetExcavator;
|
||||
form.Show();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
using Excavator.Drawnings;
|
||||
using Excavator.Entities;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar;
|
||||
|
||||
namespace Excavator;
|
||||
/// <summary>
|
||||
@ -13,7 +12,7 @@ public partial class FormExcavatorConfig : Form
|
||||
/// <summary>
|
||||
/// Событие для передачи объекта
|
||||
/// </summary>
|
||||
public event ExcavatorDelegate? ExcavatorDelegate;
|
||||
public event Action<DrawningSimpleExcavator>? _excavatorDelegate;
|
||||
|
||||
public FormExcavatorConfig()
|
||||
{
|
||||
@ -35,9 +34,9 @@ public partial class FormExcavatorConfig : Form
|
||||
/// Привязка внешнего метода к событию
|
||||
/// </summary>
|
||||
/// <param name="truckDelegate"></param>
|
||||
public void AddEvent(ExcavatorDelegate excavatorDelegate)
|
||||
public void AddEvent(Action<DrawningSimpleExcavator>? excavatorDelegate)
|
||||
{
|
||||
ExcavatorDelegate += excavatorDelegate;
|
||||
_excavatorDelegate += excavatorDelegate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -108,7 +107,7 @@ public partial class FormExcavatorConfig : Form
|
||||
{
|
||||
if (_excavator != null)
|
||||
{
|
||||
ExcavatorDelegate?.Invoke(_excavator);
|
||||
_excavatorDelegate?.Invoke(_excavator);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user