public static void Process()
        {
            DelayedObjectManager pDelayMan = DelayedObjectManager.PrivGetInstance();

            CollObserver pNode = pDelayMan.head;

            while (pNode != null)
            {
                // Fire off listener
                pNode.Execute();

                pNode = (CollObserver)pNode.pNext;
            }


            // remove
            pNode = pDelayMan.head;
            CollObserver pTmp = null;

            while (pNode != null)
            {
                pTmp  = pNode;
                pNode = (CollObserver)pNode.pNext;

                // remove
                pDelayMan.PrivDetach(pTmp, ref pDelayMan.head);
            }
        }
Exemplo n.º 2
0
        public void Notify()
        {
            CollObserver pNode = this.pHead;

            while (pNode != null)
            {
                // Fire off listener
                pNode.Notify();

                pNode = (CollObserver)pNode.pNext;
            }
        }
        //----------------------------------------------------------------------------------
        // Private Methods
        //----------------------------------------------------------------------------------
        private void PrivDetach(CollObserver node, ref CollObserver head)
        {
            // protection
            Debug.Assert(node != null);

            if (node.pPrev != null)
            {   // middle or last node
                node.pPrev.pNext = node.pNext;
            }
            else
            {  // first
                head = (CollObserver)node.pNext;
            }

            if (node.pNext != null)
            {   // middle node
                node.pNext.pPrev = node.pPrev;
            }
        }
Exemplo n.º 4
0
        // ---------------- Methods ----------------

        public void Attach(CollObserver pObserver)
        {
            Debug.Assert(pObserver != null);

            pObserver.pSubject = this;

            //add to the front
            if (this.pHead == null)
            {
                pHead           = pObserver;
                pObserver.pPrev = null;
                pObserver.pNext = null;
            }
            else
            {
                pObserver.pNext  = this.pHead;
                this.pHead.pPrev = pObserver;
                this.pHead       = pObserver;
            }
        }
        //----------------------------------------------------------------------------------
        // Static Methods
        //----------------------------------------------------------------------------------
        public static void Attach(CollObserver observer)
        {
            // protection
            Debug.Assert(observer != null);

            DelayedObjectManager pDelayMan = DelayedObjectManager.PrivGetInstance();

            // add to front
            if (pDelayMan.head == null)
            {
                pDelayMan.head = observer;
                observer.pNext = null;
                observer.pPrev = null;
            }
            else
            {
                observer.pNext       = pDelayMan.head;
                observer.pPrev       = null;
                pDelayMan.head.pPrev = observer;
                pDelayMan.head       = observer;
            }
        }
Exemplo n.º 6
0
 public void Detach(CollObserver pObserver)
 {
 }
Exemplo n.º 7
0
 // ---------------- Constructor ----------------
 public CollSubject()
 {
     this.pHead = null;
     this.pObjA = null;
     this.pObjB = null;
 }
Exemplo n.º 8
0
 public void Attach(CollObserver pObserver)
 {
     // delegate
     this.poSubject.Attach(pObserver);
 }
 //----------------------------------------------------------------------------------
 // Constructor
 //----------------------------------------------------------------------------------
 private DelayedObjectManager()
 {
     this.head = null;
 }