Esempio n. 1
0
 void HandleServerEvent(object sender, ServerEventArgs e)
 {
     Console.WriteLine("User {0} sent {1} : {3}", e.UserName, e.EventName, e.Message);
 }
Esempio n. 2
0
        protected virtual void RaiseServerEvent(string eventName, string userName, string message)
        {
            var e = new ServerEventArgs(eventName, userName, message);
              // 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<ServerEventArgs> handler = ServerEvent;

              // Event will be null if there are no subscribers
              if (handler != null)
              {

            // Use the () operator to raise the event.
            handler(this, e);
              }
        }