Example #1
0
 //*********************************************************************//
 // Form closing.  If the connection thread was ever created then kill  //
 // it off.                                                             //
 //*********************************************************************//
 private void FormTrafficLight_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (threadConnection != null)
     {
         threadConnection.StopThread();
     }
 }
        //*********************************************************************//
        // Form closing.  If the connection thread was ever created then kill  //
        // it off.                                                             //
        //*********************************************************************//
        private void FormTrafficLight_FormClosing(object sender, FormClosingEventArgs e)
        {
            MessageProtocol disconncetionMessage = new MessageProtocol(uniqueIDNumber, "ClientDisconnecting", "-");

            sendString(disconncetionMessage.GetMessageToSend(), textBoxLightIP.Text);

            if (threadConnection != null)
            {
                threadConnection.StopThread();
            }
        }