Esempio n. 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);
                }
            }
        }
Esempio n. 2
0
        void Callback(IAsyncResult ar)
        {
            AuthenticationEventHandler d = (AuthenticationEventHandler)ar.AsyncState;

            if (d.EndInvoke(ar))
            {
                OnLoggedIn(new EventArgs());
            }
            else
            {
                OnLoggedError(new EventArgs());
            }
        }
Esempio n. 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();
        }
    }