изменение кнопки на лямбду и исправление бага с добавлением ничего

This commit is contained in:
bekodeg 2023-11-07 12:23:36 +04:00
parent e5a45732e9
commit d03960db79
3 changed files with 5 additions and 18 deletions

View File

@ -299,7 +299,6 @@
buttonClose.TabIndex = 11;
buttonClose.Text = "Отмена";
buttonClose.UseVisualStyleBackColor = true;
buttonClose.Click += buttonClose_Click;
//
// panelObject
//

View File

@ -50,10 +50,5 @@ namespace ProjectElectricLocomotive
{
ButtonOk_Click(sender, e);
}
private void buttonClose_Click(object sender, EventArgs e)
{
ButtonClose_Click(sender, e);
}
}
}

View File

@ -36,6 +36,7 @@ namespace ProjectElectricLocomotive
panelYellow.MouseDown += PanelColor_MouseDown;
panelBlue.MouseDown += PanelColor_MouseDown;
// TODO buttonCancel.Click with lambda
buttonClose.Click += (sender, e) => Close();
}
/// <summary>
@ -192,18 +193,10 @@ namespace ProjectElectricLocomotive
/// <param name="e"></param>
private void ButtonOk_Click(object sender, EventArgs e)
{
EventAddLocomotive?.Invoke(_locomotive);
Close();
}
/// <summary>
/// Отмена Добавления локомотива
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ButtonClose_Click(object sender, EventArgs e)
{
EventAddLocomotive?.Invoke(_locomotive);
if (_locomotive is not null)
{
EventAddLocomotive?.Invoke(_locomotive);
}
Close();
}
}