Example #1
0
        protected virtual void RaiseServerTextReceivedEvent(TextReceivedEventArgs e)
        {
            // within this method we are creating a temporary copy of the EventHandler object to avoid any race conditions
            EventHandler <TextReceivedEventArgs> custom_event = ServerTextReceivedEvent;

            if (custom_event != null)
            {
                // here Object sender will point to custom_event which is an instance of ClientConnectedEvent event
                custom_event(this, e);
            }
        }
Example #2
0
 void HandleTextReceived(Object sender, TextReceivedEventArgs trea)
 {
     txtConsole.AppendText(string.Format("{0} - Received from {1}: {2}{3}", DateTime.Now, trea.WhoTheFuckClientSentThisText.Trim(), trea.TextReceived.Trim(), Environment.NewLine));
 }