public virtual bool ExecuteDefaultCardAction(Card card) { var defaultCardAction = GetDefaultCardAction(); if (defaultCardAction == null || !card.TryToManipulate()) return false; group.KeepControl(); card.KeepControl(); if (defaultCardAction.Execute != null) ScriptEngine.ExecuteOnCards(defaultCardAction.Execute, Selection.ExtendToSelection(card)); else if (defaultCardAction.BatchExecute != null) ScriptEngine.ExecuteOnBatch(defaultCardAction.BatchExecute, Selection.ExtendToSelection(card)); group.ReleaseControl(); card.ReleaseControl(); return true; }
public void ExecuteDefaultAction(Card card) { if (_defaultCardAction != null) { if (!card.TryToManipulate()) return; group.KeepControl(); card.KeepControl(); if (_defaultCardAction.Execute != null) ScriptEngine.ExecuteOnCards(_defaultCardAction.Execute, Selection.ExtendToSelection(card)); else if (_defaultCardAction.BatchExecute != null) ScriptEngine.ExecuteOnBatch(_defaultCardAction.BatchExecute, Selection.ExtendToSelection(card)); group.ReleaseControl(); card.ReleaseControl(); } else ExecuteDefaultAction(); }