From bc218c4adf31373662105ba5950ad212ee65cac0 Mon Sep 17 00:00:00 2001 From: nikos77781 Date: Mon, 22 Apr 2024 17:53:15 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B4=D0=B5=D0=BB=D0=B5=D0=B3=D0=B0=D1=82=20?= =?UTF-8?q?=D0=B8=20cancel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Excavator/Excavator/ExcavatorDelegate.cs | 10 ---------- Excavator/Excavator/FormExcavatorCollection.cs | 2 +- Excavator/Excavator/FormExcavatorConfig.cs | 9 ++++----- 3 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 Excavator/Excavator/ExcavatorDelegate.cs diff --git a/Excavator/Excavator/ExcavatorDelegate.cs b/Excavator/Excavator/ExcavatorDelegate.cs deleted file mode 100644 index fb92925..0000000 --- a/Excavator/Excavator/ExcavatorDelegate.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Excavator.Drawnings; - -namespace Excavator; - -/// -/// Делегат передачи объекта класса-прорисовки -/// -/// -public delegate void ExcavatorDelegate(DrawningSimpleExcavator excavator); - diff --git a/Excavator/Excavator/FormExcavatorCollection.cs b/Excavator/Excavator/FormExcavatorCollection.cs index 47dfdc5..eee3926 100644 --- a/Excavator/Excavator/FormExcavatorCollection.cs +++ b/Excavator/Excavator/FormExcavatorCollection.cs @@ -35,7 +35,7 @@ public partial class FormExcavatorCollection : Form return; } FormExcavatorConfig form = new(); - form.ExcavatorDelegate += SetExcavator; + form._excavatorDelegate += SetExcavator; form.Show(); } diff --git a/Excavator/Excavator/FormExcavatorConfig.cs b/Excavator/Excavator/FormExcavatorConfig.cs index 967f9c9..12f45ea 100644 --- a/Excavator/Excavator/FormExcavatorConfig.cs +++ b/Excavator/Excavator/FormExcavatorConfig.cs @@ -1,6 +1,5 @@ using Excavator.Drawnings; using Excavator.Entities; -using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; namespace Excavator; /// @@ -13,7 +12,7 @@ public partial class FormExcavatorConfig : Form /// /// Событие для передачи объекта /// - public event ExcavatorDelegate? ExcavatorDelegate; + public event Action? _excavatorDelegate; public FormExcavatorConfig() { @@ -35,9 +34,9 @@ public partial class FormExcavatorConfig : Form /// Привязка внешнего метода к событию /// /// - public void AddEvent(ExcavatorDelegate excavatorDelegate) + public void AddEvent(Action? excavatorDelegate) { - ExcavatorDelegate += excavatorDelegate; + _excavatorDelegate += excavatorDelegate; } /// @@ -108,7 +107,7 @@ public partial class FormExcavatorConfig : Form { if (_excavator != null) { - ExcavatorDelegate?.Invoke(_excavator); + _excavatorDelegate?.Invoke(_excavator); Close(); } }