/// <summary> /// 在调用此命令时要调用的方法。 /// 备注:请在此方法的最后一定加上 OnExecuted /// </summary> /// <param name="parameter"></param> public virtual async void Execute(object parameter) { var cancellationToken = Cancel.Initialization(); IsCompleted = false; IsFaulted = false; Exception = null; // 备注:此方法会触发所有 ICommand.CanExecute CommandManager.InvalidateRequerySuggested(); try { await ExecuteDelegate.Invoke(parameter, cancellationToken); IsCancel = cancellationToken.IsCancellationRequested; } catch (OperationCanceledException) { IsCancel = true; } catch (Exception ex) { IsFaulted = true; Exception = ex; } IsCompleted = true; CommandManager.InvalidateRequerySuggested(); OnExecuted(); }
public void Execute() { if (OnExecute != null) { OnExecute.Invoke(); } }
public void Execute(object parameter) { if (CanExecute(parameter ?? value)) { ExecuteDelegate?.Invoke(parameter ?? value); } }
public ItemTrigggerEffectBefore(CheckConditionDelegate onCheckCondition, ExecuteDelegate onExecute) : base(PileName.ITEM, onCheckCondition, null, async(g, c, a) => { await onExecute?.Invoke(g, c, a); await c.damage(g, c, 1); await g.updateDeath(); }) { }
public ItemTrigggerEffectAfter(CheckConditionDelegate onCheckCondition, ExecuteDelegate onExecute) : base(PileName.ITEM, onCheckCondition, null, async(g, c, a) => { await onExecute?.Invoke(g, c, a); c.setCurrentLife(c.getCurrentLife(g) - 1); await g.updateDeath(); }) { }
public void Execute(string commandName) { if (this.CommandList.ContainsKey(commandName)) { ExecuteDelegate execMethod = this.CommandList[commandName].ExecuteMethod; if (execMethod != null) { execMethod.Invoke(); } } }
public void Execute(object parameter) { if (ParameterizedExecuteDelegate != null) { ParameterizedExecuteDelegate(parameter); } else { ExecuteDelegate?.Invoke(); } }
protected T ExecuteQuery <T>(ExecuteDelegate <T> del) { try { var mongoCollection = this.dataBase.GetCollection <Y>(this.collection); return(del.Invoke(mongoCollection)); } catch (Exception ex) { throw this.ProcessException(ex); } }
public BeforeYourTurnEnd(ExecuteDelegate onExecute) : base(PileName.FIELD, (game, card, arg) => { return(arg.player == card.getOwner()); }, null, async(game, card, arg) => { if (onExecute != null) { await onExecute.Invoke(game, card, arg); await game.updateDeath(); } }) { }
public void Execute(object parameter) { var window = parameter as Window; if (window != null) { window.Effect = new BlurEffect { Radius = 4 }; } ExecuteDelegate?.Invoke(parameter); if (window != null) { window.Effect = null; window.Close(); } }
public THHEffectAfter(string pile, CheckConditionDelegate onCheckCondition, CheckTargetDelegate onCheckTarget, ExecuteDelegate onExecute) : base(new After <T>(), pile, (game, card, vars) => { if (onCheckCondition != null && vars != null && vars.Length > 0 && vars[0] is T t) { return(onCheckCondition.Invoke(game, card, t)); } else { return(true); } }, onCheckTarget, (game, card, vars, targets) => { if (onExecute != null && vars != null && vars.Length > 0 && vars[0] is T t) { return(onExecute.Invoke(game, card, t)); } else { return(Task.CompletedTask); } }) { }
public void Execute(object parameter) { _Execute.Invoke(parameter); }
public void Execute(object parameter) => ExecuteDelegate?.Invoke(parameter);
public void ExecuteStage() { execute.Invoke(); }
public void Execute(object parameter) { _execMethod?.Invoke(parameter); }
public void Execute(object parameter) { ExecuteDelegate?.Invoke(parameter, null); }
/// <summary> /// Executes the actual command /// </summary> /// <param name="parameter">THe command parameter to be passed</param> public void Execute(object parameter) { ExecuteDelegate?.Invoke(parameter); ExecuteDelegateWithoutObject?.Invoke(); }
/// <summary> /// 执行操作核心 /// </summary> protected override void ExecuteCore() { ExecuteDelegate?.Invoke(); }