Almost ready lab 5 for push

This commit is contained in:
ekallin 2023-11-07 12:45:40 +04:00
parent b66bd4fcba
commit 65f140055c
3 changed files with 10 additions and 18 deletions

View File

@ -1,15 +0,0 @@
using ProjectElectricLocomotive.DrawingObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectElectricLocomotive
{
/// <summary>
/// Делегат для передачи объекта-локомотив
/// </summary>
/// <param name="loco"></param>
public delegate void Action(DrawingLocomotive loco);
}

View File

@ -330,7 +330,7 @@
this.ButtonOk.TabIndex = 2;
this.ButtonOk.Text = "Добавить";
this.ButtonOk.UseVisualStyleBackColor = true;
this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click);
// this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click);
//
// buttonCancel
//

View File

@ -13,6 +13,7 @@ namespace ProjectElectricLocomotive
{
public partial class FormLocomotiveConfig : Form
{
/// <summary>
/// Переменная-выбранный локомотив
/// </summary>
@ -22,7 +23,7 @@ namespace ProjectElectricLocomotive
/// Событие
/// </summary>
private event Action? EventAddLoco;
private event Action<DrawingLocomotive>? EventAddLoco;
public FormLocomotiveConfig()
{
@ -37,6 +38,12 @@ namespace ProjectElectricLocomotive
panelPastelLilac.MouseDown += PanelColor_MouseDown;
panelPastelViolet.MouseDown += PanelColor_MouseDown;
/*ButtonOk.Click += delegate
{
EventAddLoco?.Invoke(_loco);
Close();
};*/
buttonCancel.Click += (sender, e) => Close();
}
@ -44,7 +51,7 @@ namespace ProjectElectricLocomotive
/// Добавление события
/// </summary>
/// <param name="ev">Привязанный метод</param>
public void AddEvent(Action ev)
public void AddEvent(Action<DrawingLocomotive> ev)
{
if (EventAddLoco == null)
{