PIbd_13 Klykov_N.V. LabWork05 Simple #7

Closed
nikos77781 wants to merge 3 commits from Lab05 into Lab04
3 changed files with 5 additions and 16 deletions
Showing only changes of commit bc218c4adf - Show all commits

View File

@ -1,10 +0,0 @@
using Excavator.Drawnings;
namespace Excavator;
/// <summary>
/// Делегат передачи объекта класса-прорисовки
/// </summary>
/// <param name="excavator"></param>
public delegate void ExcavatorDelegate(DrawningSimpleExcavator excavator);

View File

@ -35,7 +35,7 @@ public partial class FormExcavatorCollection : Form
return;
}
FormExcavatorConfig form = new();
form.ExcavatorDelegate += SetExcavator;
form._excavatorDelegate += SetExcavator;
form.Show();
}

View File

@ -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();
}
}