Beispiel #1
0
 protected virtual void OnSent(DataEventArgs e)
 {
     if (Sent != null)
     {
         Sent(this, e);
     }
 }
Beispiel #2
0
 private static void serialPort_Received(object sender, DataEventArgs e)
 {
     Key = e.Buffer;
 }
Beispiel #3
0
 protected virtual void OnReceived(DataEventArgs e)
 {
     if (Received != null) {
         Received(this, e);
     }
 }
 private void serialPort_Received(object sender, DataEventArgs e)
 {
     try
     {
         byte[] ECM = new byte[9];
         Array.Copy(e.Buffer,ECM,9);
         if (Strings.ToHex(ECM).StartsWith("0706"))
             client.Send(ECM);
         else
         {
             KryptonMessageBox.Show("Le protocole twin n'est pas selectionné", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
             throw new IOException();
         }
     }
     catch(IOException)
     {
         KryptonMessageBox.Show("Connection is down ", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
         client.Disconnect();
         serialPort.Close();
     }
 }