Esempio n. 1
0
        // Call event listeners when ONLINE USERS change
        private void SafeInvokeOnlineUsersChanged(Dictionary <string, string> listOfOnlineUsers)
        {
            if (!serverActive)
            {
                return;
            }

            if (OnlineUsersChanged == null)
            {
                return;         //No Listeners
            }
            OnlineUsersChangedEvent listener = null;

            Delegate[] dels = OnlineUsersChanged.GetInvocationList();

            foreach (Delegate del in dels)
            {
                try
                {
                    listener = (OnlineUsersChangedEvent)del;
                    listener.Invoke(listOfOnlineUsers);
                }
                catch (Exception ex)
                {
                    //Could not reach the destination, so remove it
                    //from the list
                    OnlineUsersChanged -= listener;
                }
            }
        }
Esempio n. 2
0
 private void ChatHubProxyOnOnlineUsersChanged(IEnumerable <SimpleUser> obj)
 {
     Application.Current.Dispatcher.Invoke(() => { OnlineUsersChanged?.Invoke(new OnlineUsersChangedEventArgs(obj)); });
 }