Beispiel #1
0
        protected virtual void OnAuthenticate(EventArgs e)
        {
            AuthenticationEventHandler authHandler = Authenticated;

            if (authHandler != null)
            {
                foreach (AuthenticationEventHandler handler in authHandler.GetInvocationList())
                {
                    handler.BeginInvoke(this, e, new AsyncCallback(Callback), handler);
                }
            }
        }
Beispiel #2
0
        void Callback(IAsyncResult ar)
        {
            AuthenticationEventHandler d = (AuthenticationEventHandler)ar.AsyncState;

            if (d.EndInvoke(ar))
            {
                OnLoggedIn(new EventArgs());
            }
            else
            {
                OnLoggedError(new EventArgs());
            }
        }
Beispiel #3
0
    void OnAuthenticationChanged(bool state)
    {
        // make a temporary copy of the event to avoid possibility of
        // a race condition if the last subscriber unsubscribes
        // immediately after the null check and before the event is raised
        AuthenticationEventHandler handler = null;

        lock (this)
        {
            handler = m_AuthenticationChanged;
        }

        // raise event
        if (handler != null)
        {
            handler(state);
        }

        if (state == true)
        {
            CheckCloudDateTime();
        }
    }