Esempio n. 1
0
 public void Pop(InputListener l)
 {
     if (stack.Peek() == l)
     {
         stack.Pop();
         InputListener stackTop = GetStackTop();
         if (stackTop != null)
         {
             stackTop.OnFocus(true, l);
         }
     }
     else if (!stack.IsEmpty())
     {
         // Remove element in the middle of the stack
         log.Warn("Stack Top: {0}, request:{1}", stack.Peek(), l);
         Stack <InputListener> backup = new Stack <InputListener> ();
         while (!stack.IsEmpty() && stack.Peek() != l)
         {
             backup.Push(stack.Pop());
         }
         stack.Pop();
         while (!backup.Empty())
         {
             stack.Push(backup.Pop());
         }
     }
     else
     {
         log.Warn("no stack pop for {0}", l);
     }
 }
Esempio n. 2
0
        public void Push(InputListener l)
        {
            InputListener stackTop = GetStackTop();

            if (stackTop != null)
            {
                stackTop.OnFocus(false, l);
            }
            if (!stack.Contains(l))
            {
                stack.Push(l);
            }
            else
            {
                log.Warn("{0} is already in InputListenerStack", l);
            }
        }