Ejemplo n.º 1
0
        bool RemoveAction(CAction action)
        {
            if (m_actions.Remove(action.Id))
            {
                if (m_delegate != null)
                {
                    m_delegate.OnActionUnregistered(this, action);
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public CAction RegisterAction(string name, Delegate actionDelegate)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (name.Length == 0)
            {
                throw new ArgumentException("Action's name is empty");
            }

            if (actionDelegate == null)
            {
                throw new ArgumentNullException("actionDelegate");
            }

            CAction action = m_actions.Find(name);

            if (action != null)
            {
                // Log.w("Overriding action: {0}", name);
                action.ActionDelegate = actionDelegate;
            }
            else
            {
                action = new CAction(name, actionDelegate);
                m_actions.Add(action);

                if (m_delegate != null)
                {
                    m_delegate.OnActionRegistered(this, action);
                }
            }

            return(action);
        }