Exemplo n.º 1
0
        /// コンストラクタ
        public Gear(IGearHolder holder)
        {
            _holder        = holder;
            _childGearList = new List <Gear>();
            _diffuser      = new Diffuser(this);

            _phase = GearPhase.Create;

            _preparationDispatcher = new GearDispatcher(AddBehavior.MethodType.addTail, true, new PosInfos());
            _startDispatcher       = new GearDispatcher(AddBehavior.MethodType.addTail, true, new PosInfos());
            _endDispatcher         = new GearDispatcher(AddBehavior.MethodType.addHead, true, new PosInfos());
        }
Exemplo n.º 2
0
        private void Dispose(bool isDisposing)
        {
            if (_phase != GearPhase.Dispose)
            {
                if (isDisposing)
                {
                    //
                    _holder = null;

                    var enumerator = _childGearList.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        enumerator.Current.Dispose();
                    }

                    _endDispatcher.Execute(new PosInfos());                    // 逆順で実行する
                    _endDispatcher = null;

                    _childGearList.Clear();
                    _diffuser.Dispose();
                }
                _phase = GearPhase.Dispose;
            }
        }