/// Handler削除(追加時に得たCancelKeyを使う) public void Remove(CancelKey key) { if (_executeLock) { throw new Exception("実行最中の削除はできません"); } GearDispatcherHandler <TFunc> rmhandler = null; var enumerator = _list.GetEnumerator(); while (enumerator.MoveNext()) { GearDispatcherHandler <TFunc> handler = enumerator.Current; if ((CancelKey)handler == key) { rmhandler = handler; break; } } if (rmhandler != null) { _list.Remove(rmhandler); } }
/// Handler追加(削除用のCancelKeyが返る) public CancelKey Add(TFunc func, PosInfos addPos) { GearDispatcherHandler <TFunc> handler = new GearDispatcherHandler <TFunc>(func, addPos); AddBehavior.Execute(_addBehavior, _list, handler); return(handler); }
/// 実行本体 private void Trat(GearDispatcherHandler <Action> handler) { handler._func(); }