예제 #1
0
    /// <summary>
    /// sends an event
    /// </summary>
    public static void Send(string name, GlobalEventMode mode)
    {
        if (string.IsNullOrEmpty(name))
        {
            throw new ArgumentNullException(@"name");
        }

        List <GlobalCallback> callbacks = (List <GlobalCallback>)m_Callbacks[name];

        if (callbacks != null)
        {
            Call(callbacks);
        }
        else if (mode == GlobalEventMode.REQUIRE_LISTENER)
        {
            throw GlobalEventInternal.ShowSendException(name);
        }
    }
예제 #2
0
    /// <summary>
    /// Unregisters the event specified by name
    /// </summary>
    public static void UnRegister(string name, GlobalCallback callback)
    {
        if (string.IsNullOrEmpty(name))
        {
            throw new ArgumentNullException(@"name");
        }

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

        List <GlobalCallback> callbacks = (List <GlobalCallback>)m_Callbacks[name];

        if (callbacks != null)
        {
            callbacks.Remove(callback);
        }
        else
        {
            throw GlobalEventInternal.ShowUnregisterException(name);
        }
    }