This commit is contained in:
Кашин Максим 2022-11-13 21:33:30 +04:00
parent 8e5a2bdeca
commit 4116ffde87
3 changed files with 3 additions and 19 deletions

View File

@ -13,7 +13,7 @@ namespace GasolineTanker
public partial class FormGasolineTankerConfig : Form
{
DrawingGasolineTanker _gasolineTanker = null;
private event GasolineTankerDelegate EventAddGasolineTanker;
private event Action<DrawingGasolineTanker> EventAddGasolineTanker;
public FormGasolineTankerConfig()
{
InitializeComponent();
@ -29,11 +29,11 @@ namespace GasolineTanker
buttonCancel.Click += (s, e) => Close();
}
public void AddEvent(GasolineTankerDelegate ev)
public void AddEvent(Action<DrawingGasolineTanker> ev)
{
if (EventAddGasolineTanker == null)
{
EventAddGasolineTanker = new GasolineTankerDelegate(ev);
EventAddGasolineTanker = ev;
}
else
{

View File

@ -87,8 +87,6 @@ namespace GasolineTanker
}
}
private void ButtonShowStorage_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)
@ -112,7 +110,6 @@ namespace GasolineTanker
{
return;
}
//получаем имя кнопки
string name = ((Button)sender)?.Name ?? string.Empty;
Direction dir = Direction.None;
switch (name)
@ -132,7 +129,6 @@ namespace GasolineTanker
}
pictureBox.Image = _mapGasolineTankerCollectionGeneric.MoveObject(dir);
}
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
{
AbstractMap map = null;
@ -155,7 +151,6 @@ namespace GasolineTanker
_mapGasolineTankerCollectionGeneric = null;
}
}
private void buttonAddMap_Click(object sender, EventArgs e)
{
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
@ -171,7 +166,6 @@ namespace GasolineTanker
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
ReloadMaps();
}
private void buttonDeleteMap_Click(object sender, EventArgs e)
{
if (listBoxMaps.SelectedIndex == -1)

View File

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