Event work

This commit is contained in:
Semka 2022-11-14 02:12:00 +04:00
parent 73a6c4e323
commit a9f381a84f
2 changed files with 24 additions and 12 deletions

View File

@ -88,16 +88,19 @@ namespace GasolineTanker
}
private void ButtonAddTanker_Click(object sender, EventArgs e)
{
var formTankerConfig = new FormTankerConfig();
formTankerConfig.AddEvent(InsertTankerCheck);
formTankerConfig.Show();
}
private void InsertTankerCheck(DrawningTanker _tanker)
{
if (listBoxMaps.SelectedIndex == -1)
{
return;
}
FormTanker form = new();
if (form.ShowDialog() == DialogResult.OK)
{
DrawningObjectTanker tanker = new(form.SelectedTanker);
if ((_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + tanker != -1))
DrawningObjectTanker tanker = new(_tanker);
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + tanker >= 0)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
@ -107,7 +110,6 @@ namespace GasolineTanker
MessageBox.Show("Не удалось добавить объект");
}
}
}
private void ButtonRemoveTanker_Click(object sender, EventArgs e)
{

View File

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GasolineTanker
{
public delegate void TankerDelegate(DrawningTanker tanker);
}