Event work
This commit is contained in:
parent
73a6c4e323
commit
a9f381a84f
@ -88,24 +88,26 @@ namespace GasolineTanker
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonAddTanker_Click(object sender, EventArgs e)
|
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)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FormTanker form = new();
|
DrawningObjectTanker tanker = new(_tanker);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + tanker >= 0)
|
||||||
{
|
{
|
||||||
DrawningObjectTanker tanker = new(form.SelectedTanker);
|
MessageBox.Show("Объект добавлен");
|
||||||
if ((_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + tanker != -1))
|
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||||
{
|
}
|
||||||
MessageBox.Show("Объект добавлен");
|
else
|
||||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
{
|
||||||
}
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
GasolineTanker/GasolineTanker/TankerDelegate.cs
Normal file
10
GasolineTanker/GasolineTanker/TankerDelegate.cs
Normal 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);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user