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.TabIndex = 2;
this.ButtonOk.Text = "Добавить"; this.ButtonOk.Text = "Добавить";
this.ButtonOk.UseVisualStyleBackColor = true; this.ButtonOk.UseVisualStyleBackColor = true;
this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click); // this.ButtonOk.Click += new System.EventHandler(this.ButtonOk_Click);
// //
// buttonCancel // buttonCancel
// //

View File

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