Exemplo n.º 1
0
        public void Refresh(DeadLock deadlock)
        {
            List <DeadLockItem> deadLockItems     = deadlock.Items;
            TreeNodeCollection  deadLockItemNodes = r_deadlockNode.Nodes;

            int countNew = deadLockItems.Count;
            int countOld = deadLockItemNodes.Count;
            int to       = countNew;

            if (countNew < countOld)
            {
                for (int i = countNew; i < countOld; ++i)
                {
                    r_deadLockItemNodes[countNew].Remove();
                    r_deadLockItemNodes.RemoveAt(countNew);
                }
            }
            else if (countOld < countNew)
            {
                to = countOld;
                for (int i = 0; i < (countNew - countOld); ++i)
                {
                    DeadLockItemNode deadLockItemNode = new DeadLockItemNode(r_manager, r_deadlockNode, deadLockItems[countOld + i]);
                    r_deadLockItemNodes.Add(deadLockItemNode);
                }
            }

            for (int i = 0; i < to; ++i)
            {
                r_deadLockItemNodes[i].Refresh(deadLockItems[i]);
            }
        }
Exemplo n.º 2
0
        public void Refresh(DeadLock deadlock)
        {
            List<DeadLockItem> deadLockItems = deadlock.Items;
            TreeNodeCollection deadLockItemNodes = r_deadlockNode.Nodes;

            int countNew = deadLockItems.Count;
            int countOld = deadLockItemNodes.Count;
            int to = countNew;

            if (countNew < countOld)
            {
                for (int i = countNew; i < countOld; ++i)
                {
                    r_deadLockItemNodes[countNew].Remove();
                    r_deadLockItemNodes.RemoveAt(countNew);
                }
            }
            else if (countOld < countNew)
            {
                to = countOld;
                for (int i = 0; i < (countNew - countOld); ++i)
                {
                    DeadLockItemNode deadLockItemNode = new DeadLockItemNode(r_manager, r_deadlockNode, deadLockItems[countOld + i]);
                    r_deadLockItemNodes.Add(deadLockItemNode);
                }
            }

            for (int i = 0; i < to; ++i)
            {
                r_deadLockItemNodes[i].Refresh(deadLockItems[i]);
            }
        }