private void Targetting(object sender, EventArgs e)
{
var targetAction = (Target)sender;
CardControl fromCard = null, toCard = null;
foreach (ContentPresenter child in Children)
{
if (targetAction.FromCard == child.DataContext)
{
fromCard = VisualTreeHelper.GetChild(child, 0) as CardControl;
if (toCard != null)
{
break;
}
}
else if (targetAction.ToCard == child.DataContext)
{
toCard = VisualTreeHelper.GetChild(child, 0) as CardControl;
if (fromCard != null)
{
break;
}
}
}
if (fromCard == null || toCard == null)
{
return;
}
fromCard.CreateArrowTo(targetAction.Who, toCard);
targetAction.FromCard.TargetsOtherCards = true;
}