Итог
This commit is contained in:
parent
8e5a2bdeca
commit
4116ffde87
@ -13,7 +13,7 @@ namespace GasolineTanker
|
|||||||
public partial class FormGasolineTankerConfig : Form
|
public partial class FormGasolineTankerConfig : Form
|
||||||
{
|
{
|
||||||
DrawingGasolineTanker _gasolineTanker = null;
|
DrawingGasolineTanker _gasolineTanker = null;
|
||||||
private event GasolineTankerDelegate EventAddGasolineTanker;
|
private event Action<DrawingGasolineTanker> EventAddGasolineTanker;
|
||||||
public FormGasolineTankerConfig()
|
public FormGasolineTankerConfig()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -29,11 +29,11 @@ namespace GasolineTanker
|
|||||||
buttonCancel.Click += (s, e) => Close();
|
buttonCancel.Click += (s, e) => Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEvent(GasolineTankerDelegate ev)
|
public void AddEvent(Action<DrawingGasolineTanker> ev)
|
||||||
{
|
{
|
||||||
if (EventAddGasolineTanker == null)
|
if (EventAddGasolineTanker == null)
|
||||||
{
|
{
|
||||||
EventAddGasolineTanker = new GasolineTankerDelegate(ev);
|
EventAddGasolineTanker = ev;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -87,8 +87,6 @@ namespace GasolineTanker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
private void ButtonShowStorage_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
@ -112,7 +110,6 @@ namespace GasolineTanker
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//получаем имя кнопки
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
Direction dir = Direction.None;
|
Direction dir = Direction.None;
|
||||||
switch (name)
|
switch (name)
|
||||||
@ -132,7 +129,6 @@ namespace GasolineTanker
|
|||||||
}
|
}
|
||||||
pictureBox.Image = _mapGasolineTankerCollectionGeneric.MoveObject(dir);
|
pictureBox.Image = _mapGasolineTankerCollectionGeneric.MoveObject(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AbstractMap map = null;
|
AbstractMap map = null;
|
||||||
@ -155,7 +151,6 @@ namespace GasolineTanker
|
|||||||
_mapGasolineTankerCollectionGeneric = null;
|
_mapGasolineTankerCollectionGeneric = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonAddMap_Click(object sender, EventArgs e)
|
private void buttonAddMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
||||||
@ -171,7 +166,6 @@ namespace GasolineTanker
|
|||||||
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonDeleteMap_Click(object sender, EventArgs e)
|
private void buttonDeleteMap_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxMaps.SelectedIndex == -1)
|
if (listBoxMaps.SelectedIndex == -1)
|
||||||
|
@ -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);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user