Example #1
0
        /**
         * @brief dispatch the key pad msg
         */

        public bool DispatchKeypadMsg(KeypadMSGType nMsgType)
        {
            m_bLocked = true;

            if (m_pDelegates.Count > 0)
            {
                for (int i = 0; i < m_pDelegates.Count; i++)
                {
                    CCKeypadHandler  pHandler  = m_pDelegates[i];
                    CCKeypadDelegate pDelegate = pHandler.Delegate;

                    switch (nMsgType)
                    {
                    case KeypadMSGType.BackClicked:
                        pDelegate.KeyBackClicked();
                        break;

                    case KeypadMSGType.MenuClicked:
                        pDelegate.KeyMenuClicked();
                        break;
                    }
                }
            }

            m_bLocked = false;

            if (m_bToRemove)
            {
                m_bToRemove = false;
                for (int i = 0; i < m_pHandlersToRemove.Count; ++i)
                {
                    ForceRemoveDelegate(m_pHandlersToRemove[i]);
                }
                m_pHandlersToRemove.Clear();
            }

            if (m_bToAdd)
            {
                m_bToAdd = false;
                for (int i = 0; i < m_pHandlersToAdd.Count; ++i)
                {
                    ForceAddDelegate(m_pHandlersToAdd[i]);
                }
                m_pHandlersToAdd.Clear();
            }

            return(true);
        }
Example #2
0
        /**
         * @brief force add the delegate
         */

        public void ForceAddDelegate(CCKeypadDelegate pDelegate)
        {
            CCKeypadHandler pHandler = CCKeypadHandler.HandlerWithDelegate(pDelegate);

            m_pDelegates.Add(pHandler);
        }