예제 #1
0
        /// 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);
            }
        }
예제 #2
0
        /// Handler追加(削除用のCancelKeyが返る)
        public CancelKey Add(TFunc func, PosInfos addPos)
        {
            GearDispatcherHandler <TFunc> handler = new GearDispatcherHandler <TFunc>(func, addPos);

            AddBehavior.Execute(_addBehavior, _list, handler);
            return(handler);
        }
예제 #3
0
 /// 実行本体
 private void Trat(GearDispatcherHandler <Action> handler)
 {
     handler._func();
 }