Изменена отправка данных по DragAndDrop
This commit is contained in:
parent
0a5d9819bc
commit
67dde9fb10
@ -7,7 +7,6 @@ namespace AirBomber
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FormAirplaneConfig : Form
|
public partial class FormAirplaneConfig : Form
|
||||||
{
|
{
|
||||||
private Type _currTypeEngines = typeof(DrawningAirplaneEngines);
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Переменная-выбранная самолет
|
/// Переменная-выбранная самолет
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -205,13 +204,13 @@ namespace AirBomber
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_currTypeEngines = typesOfEngines.GetType();
|
(sender as Label).DoDragDrop(Tuple.Create(typesOfEngines.GetType(), typesOfEngines), DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
(sender as Label).DoDragDrop(typesOfEngines, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void labelTypesOfEngines_DragDrop(object sender, DragEventArgs e)
|
private void labelTypesOfEngines_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
var engines = (IAirplaneEngines)e.Data.GetData(_currTypeEngines);
|
var data = (Tuple<Type, IAirplaneEngines>)e.Data.GetData(typeof(Tuple<Type, IAirplaneEngines>));
|
||||||
|
var engines = data.Item2;
|
||||||
engines.CountEngines = _airplane.DrawningEngines.CountEngines;
|
engines.CountEngines = _airplane.DrawningEngines.CountEngines;
|
||||||
if (_airplane is DrawningAirBomber)
|
if (_airplane is DrawningAirBomber)
|
||||||
{
|
{
|
||||||
@ -225,6 +224,6 @@ namespace AirBomber
|
|||||||
DrawAirplane();
|
DrawAirplane();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void labelTypesOfEngines_DragEnter(object sender, DragEventArgs e) => setDragEffect(e, _currTypeEngines, _airplane != null);
|
private void labelTypesOfEngines_DragEnter(object sender, DragEventArgs e) => setDragEffect(e, typeof(Tuple<Type, IAirplaneEngines>), _airplane != null);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user