本文整理汇总了C#中IAction.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# IAction.Execute方法的具体用法?C# IAction.Execute怎么用?C# IAction.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAction
的用法示例。
在下文中一共展示了IAction.Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
protected void Execute(IAction action)
{
var signal = new ManualResetEvent(false);
action.Completed += (sender, e) => signal.Set();
action.Execute();
signal.WaitOne();
}
示例2: CommitAction
public void CommitAction(IAction action)
{
action.Execute();
undoStack.Push(action);
FireUndoStackDepthChanged();
redoStack.Clear();
FireRedoStackDepthChanged();
DirtyFlag = true;
}
示例3: Execution
private void Execution(IAction hAction)
{
try
{
hAction.Execute(m_hService, m_hContext);
}
catch (Exception hEx)
{
//Todo: error handling, creare un handler con una coda concorrente e accodare xche possono arrivare sia da piu thread contemporaneamente
Console.WriteLine("Error Executing Action " + hEx);
}
finally
{
(hAction as Packet).Recycle();
}
}
示例4: Execute
/// <summary>
/// Run the Execute() method of the IAction
/// </summary>
/// <param name="wTestObject"></param>
/// <param name="action"></param>
/// <returns></returns>
public IAction Execute(WTest wTestObject, IAction action)
{
try
{
// execute the action
action.Execute();
// get the results from the action
wTestObject.Success = action.Success;
wTestObject.Message = action.PostActionMessage;
}
catch (Exception ex)
{
wTestObject.Success = false;
wTestObject.Message = ex.Message;
if (ex.InnerException != null)
{
wTestObject.Message += ": " + ex.InnerException.Message;
}
}
return action;
}
示例5: DoPlayerAction
public IEnumerable<FightStep> DoPlayerAction(IAction action)
{
foreach (FightStep step in action.Execute(game, Player, Enemy))
{
yield return step;
}
if (surpriseAttack)
{
surpriseAttack = false;
yield break;
}
// Wizards get +1 HP per turn during battle
if (Player.Class.Type == ClassType.WIZARD)
{
Player.UpdateHitPoints(1);
yield return new HealStep(Player, 1, Player.HitPoints);
}
if (!isPlayerFirst)
{
EndOfRound();
}
if (Enemy.IsDead())
{
yield break;
}
if (IsInProgress())
{
foreach (FightStep step in DoEnemyTurn())
{
yield return step;
}
}
}
示例6: Execute
public static void Execute(IAction instance)
{
//instance.Logger = UIManager.Logger;
instance.Execute();
}
示例7: RecordAction
public void RecordAction(IAction existingAction)
{
if (existingAction != null)
{
CheckNotRunningBeforeRecording(existingAction);
if (ExecuteImmediatelyWithoutRecording && existingAction.CanExecute())
{
existingAction.Execute();
}
else
{
ITransaction recordingTransaction = RecordingTransaction;
if (recordingTransaction != null)
{
recordingTransaction.AccumulatingAction.Add(existingAction);
if (!recordingTransaction.IsDelayed)
{
existingAction.Execute();
}
}
else
{
RunActionDirectly(existingAction);
}
}
}
}
示例8: ExecuteAction
private void ExecuteAction(IAction action)
{
action.Execute();
if (ActionPerformed != null) ActionPerformed(this, new ActionEventArgs(action));
}
示例9: RecordAction
/// <summary>
/// Central method to add and execute a new action.
/// </summary>
/// <param name="existingAction">An action to be recorded in the buffer and executed</param>
public void RecordAction(IAction existingAction)
{
if (existingAction == null)
{
throw new ArgumentNullException(
"ActionManager.RecordAction: the existingAction argument is null");
}
// make sure we're not inside an Undo or Redo operation
CheckNotRunningBeforeRecording(existingAction);
// if we don't want to record actions, just run and forget it
if (ExecuteImmediatelyWithoutRecording
&& existingAction.CanExecute())
{
existingAction.Execute();
return;
}
// Check if we're inside a transaction that is being recorded
ITransaction currentTransaction = RecordingTransaction;
if (currentTransaction != null)
{
// if we're inside a transaction, just add the action to the transaction's list
currentTransaction.AccumulatingAction.Add(existingAction);
if (!currentTransaction.IsDelayed)
{
existingAction.Execute();
}
}
else
{
RunActionDirectly(existingAction);
}
}
示例10: PerformAction
public bool PerformAction(IAction action)
{
if (currentAction < actionList.Count)
{ //perform an action after some Redo's
int wegSchmeissCount = actionList.Count - currentAction;
for (int i = 1; i <= wegSchmeissCount; i++)
actionList.RemoveAt(actionList.Count-1);
}
bool validAction = action.Execute();
if (validAction)
{
actionList.Add(action);
if (actionList.Count > actionCount)
{
IAction temp = actionList[0] as IAction;
temp.Dispose();
actionList.RemoveAt(0);
} //more than actionCount actions in List
else currentAction++;
ActionlistCountChanged(currentAction, actionList.Count);
changed = true;
}
return validAction;
}
示例11: ExecuteAndRecord
/// <summary>
/// Records and executes the given IAction, and executes any existing unexecuted actions. This method must be
/// called from the thread which owns this object
/// </summary>
/// <exception cref="ArgumentNullException">action is null</exception>
/// <param name="action">The IAction instance to record and execute</param>
public void ExecuteAndRecord(IAction action)
{
VerifyAccess();
if (action == null)
{
throw new ArgumentNullException();
}
lock (this)
{
if (_lastRecorded != null)
{
Execute();
_lastRecorded = null;
}
action.Execute();
_undoStack.Push(action);
UndoAction = action;
CanUndo = true;
}
}
示例12: Execute
public void Execute(IAction action) {
action.Execute();
Push(action);
}
示例13: Execute
public void Execute(IAction hAction)
{
hAction.Execute(m_hService, m_hContext);
}
示例14: Execute
public virtual void Execute(IAction action)
{
action.Execute();
}
示例15: RecordAction
public void RecordAction(IAction existingAction)
{
if (existingAction == null)
{
throw new ArgumentNullException(
"ActionManager.RecordAction: the existingAction argument is null");
}
CheckNotRunningBeforeRecording(existingAction);
if (ExecuteImmediatelyWithoutRecording
&& existingAction.CanExecute())
{
existingAction.Execute();
return;
}
ITransaction currentTransaction = RecordingTransaction;
if (currentTransaction != null)
{
currentTransaction.AccumulatingAction.Add(existingAction);
}
else
{
RunActionDirectly(existingAction);
}
}