Пример #1
0
        protected IList <Object> EvaluatePausedEventTargets()
        {
            IdentityLinkedMap <Object, PausedEventTargetItem> pausedTargets = this.pausedTargets;
            List <Object> pausedEventTargets = new List <Object>(pausedTargets.Count);

            foreach (Entry <Object, PausedEventTargetItem> entry in pausedTargets)
            {
                PausedEventTargetItem pauseETI = entry.Value;
                pausedEventTargets.Add(pauseETI.EventTarget);
            }
            return(pausedEventTargets);
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (!(obj is PausedEventTargetItem))
            {
                return(false);
            }
            PausedEventTargetItem other = (PausedEventTargetItem)obj;

            return(Object.ReferenceEquals(EventTarget, other.EventTarget));
        }
Пример #3
0
        protected IList <Object> EvaluatePausedEventTargetsOfForeignThreads()
        {
            Thread currentThread = Thread.CurrentThread;
            IdentityLinkedMap <Object, PausedEventTargetItem> pausedTargets = this.pausedTargets;
            List <Object> pausedEventTargets = new List <Object>(pausedTargets.Count);

            foreach (Entry <Object, PausedEventTargetItem> entry in pausedTargets)
            {
                PausedEventTargetItem pauseETI = entry.Value;
                if (!Object.ReferenceEquals(pauseETI.Thread, currentThread))
                {
                    pausedEventTargets.Add(pauseETI.EventTarget);
                }
            }
            return(pausedEventTargets);
        }
Пример #4
0
        public void Pause(Object eventTarget)
        {
            if (GuiThreadHelper.IsInGuiThread())
            {
                // Nothing to do
                return;
            }
            IEventTargetExtractor eventTargetExtractor = typeToEventTargetExtractorsDict.GetExtension(eventTarget.GetType());

            if (eventTargetExtractor == null)
            {
                return;
            }
            eventTarget = eventTargetExtractor.ExtractEventTarget(eventTarget);
            if (eventTarget == null)
            {
                return;
            }
            PausedEventTargetItem etiKey = new PausedEventTargetItem(eventTarget);

            listenersWriteLock.Lock();
            try
            {
                PausedEventTargetItem pauseETI = pausedTargets.Get(eventTarget);
                if (pauseETI == null)
                {
                    pauseETI = new PausedEventTargetItem(eventTarget);
                    pausedTargets.Put(eventTarget, pauseETI);
                }
                pauseETI.PauseCount++;
            }
            finally
            {
                listenersWriteLock.Unlock();
            }
        }