/// <summary> /// Get notified when the list of online users is updated. /// </summary> private void OnlineUsersUpdated(object sender, OnlineUsersEventArgs e) { Platform.UIThread(this, delegate { _onlineUsers = e.Users; if (_welcomePage == null) { FillCanvas(); } else { _welcomePage.OnlineUsers = _onlineUsers; } }); }
protected virtual void OnRaiseOnlineUsersReceivedCustomEvent(OnlineUsersEventArgs e) { // 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. EventHandler <OnlineUsersEventArgs> handler = OnlineUsersReceivedEvent; // Event will be null if there are no subscribers if (handler != null) { // Format the string to send inside the CustomEventArgs parameter // e.Message += String.Format(" at {0}", DateTime.Now.ToString()); // Use the () operator to raise the event. handler(this, e); } }
//----------Delegates---------- //public void OnOnlineUsersChange(object source, EventArgs e) //{ // Console.WriteLine("Online users changed"); //} // Handler public void IndexOnlineUsersChangeHandler(object o, OnlineUsersEventArgs e) { DrawUserPanel(); }