protected HandleExceptionAndRetryActionDecorator(ITaskAction action, IExceptionHandler exceptionHandler) { RetryInterval = BackoffInterval.Default; _action = action; _exceptionHandler = exceptionHandler; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="taskAction"></param> public void RegisterAction(string name, ITaskAction taskAction) { lock (SyncObject) { if (this.actionMap.ContainsKey(name) == false) { this.waitIntervalMap[name] = TimeSpan.Zero; this.actionMap[name] = taskAction; } } }
// Concat public static ITaskAction Concat(this ITaskAction firstAction, ITaskAction secondAction) { #region Contracts if (firstAction == null) throw new ArgumentNullException(); if (secondAction == null) throw new ArgumentNullException(); #endregion // Return return new ConcatAction(firstAction, secondAction); }
public void AddWork(ITaskAction action) { lockSlim.EnterWriteLock(); try { queue.Enqueue(action); } finally { lockSlim.ExitWriteLock(); } }
// Constructors public ConcatAction(ITaskAction firstAction, ITaskAction secondAction) { #region Contracts if (firstAction == null) throw new ArgumentNullException(); if (secondAction == null) throw new ArgumentNullException(); #endregion // Arguments _firstAction = firstAction; _secondAction = secondAction; }
public ITaskAction RequestNextTask() { if (taskList.Count > 0) { ITaskAction task = taskList[0]; _curTask = task; taskList.RemoveAt(0); return(task); } else { // No tasks are available return(null); } }
// Constructors public TaskSetting(string taskSettingId, string taskSettingName, ITaskTrigger taskTrigger, ITaskAction taskAction) { #region Contracts if (string.IsNullOrEmpty(taskSettingName) == true) throw new ArgumentNullException(); if (taskTrigger == null) throw new ArgumentNullException(); if (taskAction == null) throw new ArgumentNullException(); #endregion // Arguments this.TaskSettingId = taskSettingId; this.TaskSettingName = taskSettingName; this.TaskTrigger = taskTrigger; this.TaskAction = taskAction; }
public static void AddWork(ITaskAction taskAction, int userId) { if (workers.ContainsKey(userId)) { workers[userId].AddWork(taskAction); } else { var worker = new Worker(); worker.AddWork(taskAction); Task.Run(() => worker.Run()); workers.Add(userId, worker); } }
public ITaskAction CreateInstanceByTypeName(string typename) { if (pairs == null) { LoadTypesInfo(); } ITaskAction obj = null; if (pairstypename.TryGetValue(typename, out var t)) { obj = CreateInstance(t); } if (obj != null) { obj.ServiceProvider = this._sp; } return(obj); }
private void ExecuteTask(ITaskAction task) { //ICharacterAnim ica = task.TheCharacter; //if (task.TheActionName.CompareTo(GameSettings.Instance.Toss) == 0) //{ // ica.AnimateToss(DelayedCallBAckWhenTossPeacks); //} //else //if (task.TheActionName.CompareTo(GameSettings.Instance.Catch) == 0) //{ //} //else // ica.AnimateNamedAction(task.TheActionName, TheCallBackAfterAnimStetends);//and when he gets there run the call backs or void Onarrivetopos(){ state= Stae.WaitingForNexrTask;} }
// Concat public static ITaskAction Concat(this ITaskAction firstAction, ITaskAction secondAction) { #region Contracts if (firstAction == null) { throw new ArgumentNullException(); } if (secondAction == null) { throw new ArgumentNullException(); } #endregion // Return return(new ConcatAction(firstAction, secondAction)); }
// Constructors public ConcatAction(ITaskAction firstAction, ITaskAction secondAction) { #region Contracts if (firstAction == null) { throw new ArgumentNullException(); } if (secondAction == null) { throw new ArgumentNullException(); } #endregion // Arguments _firstAction = firstAction; _secondAction = secondAction; }
void HeardTaskEnded() { if (!gamestarted) { return; //make listen to state change instead } ITaskAction task = TaskSys.RequestNextTask(); if (task != null) { task.RunME(); } else {//no more tasks if (sequencStarted) { BellHopGameEventManager.Instance.Call_CurSequenceChanged(GameSequenceType.PlayerInputs); } sequencStarted = false; } }
public void AddTask(ITaskAction task) { taskList.Add(task); }
public void InitActionCTRL(GameEnums.TaskSequenceType argSequenceType, ICharacterAnim argBunny, ICharacterAnim argDweller, DeliveryItem argContextItem) { _CurSequenceType = argSequenceType; MyBunny = argBunny; MyDweller = argDweller; MyContextItem = argContextItem; if (_CurSequenceType == GameEnums.TaskSequenceType.Wrongfloor) { MyBunny.AnimTrigger("Actions"); MyDweller.AnimTrigger("Actions"); MAkeWrongFloorTAsk(); ITaskAction task = taskSystem.RequestNextTask(); if (task != null) { ExecuteTask(task); } } else if (_CurSequenceType == GameEnums.TaskSequenceType.CutScene) { MyDweller.AnimTrigger("MoveOn"); // MAkeTasks(); // TheCallBackAfterAnimStetends(); } else if (_CurSequenceType == GameEnums.TaskSequenceType.Dweller_toss_Bunny) { MyBunny.AnimTrigger("Actions"); MyDweller.AnimTrigger("Actions"); MAkeDweller_toss_Bunny(); ITaskAction task = taskSystem.RequestNextTask(); if (task != null) { ExecuteTask(task); } } else if (_CurSequenceType == GameEnums.TaskSequenceType.Bunny_tossDweller) { MyBunny.AnimTrigger("Actions"); MyDweller.AnimTrigger("Actions"); MAkeBunnyTossDweller(); // TheCallBackAfterAnimStetends(); ITaskAction task = taskSystem.RequestNextTask(); if (task != null) { ExecuteTask(task); } } else if (_CurSequenceType == GameEnums.TaskSequenceType.TowWayExchange) { MyBunny.AnimTrigger("Actions"); MyDweller.AnimTrigger("Actions"); MakeToss2wayTAsk(); // TheCallBackAfterAnimStetends(); ITaskAction task = taskSystem.RequestNextTask(); if (task != null) { ExecuteTask(task); } } }
void Invoke(string aName, ITaskAction taskAction) { this.waitIntervalMap[aName] = TimeSpan.Zero; taskAction.Invoke(); }
public RetryUntilCanceledActionDecorator(ITaskAction action, IExceptionHandler exceptionHandler) : base(action, exceptionHandler) { }
public TaskActionServiceRunner(ITaskAction action, IExceptionHandler exceptionHandler) { _cancellationTokenSource = new CancellationTokenSource(); _retryUntilCanceledActionDecorator = new RetryUntilCanceledActionDecorator(action, exceptionHandler); }
public RetryOnExceptionActionDecorator(ITaskAction action, IExceptionHandler handler) : base(action, handler) { }
// Constructors public TaskSetting(string taskSettingId, string taskSettingName, ITaskTrigger taskTrigger, ITaskAction taskAction) { #region Contracts if (string.IsNullOrEmpty(taskSettingName) == true) { throw new ArgumentNullException(); } if (taskTrigger == null) { throw new ArgumentNullException(); } if (taskAction == null) { throw new ArgumentNullException(); } #endregion // Arguments this.TaskSettingId = taskSettingId; this.TaskSettingName = taskSettingName; this.TaskTrigger = taskTrigger; this.TaskAction = taskAction; }
public PolishLineStartActionLog(ITaskAction obj) { _obj = obj; }