static void ProcessEWSMessage(Message m)
{
if (m.Data.Length == 3 && m.Data[0] == 0x74)
{
if (m.Data[1] == 0x04)
{
IsKeyInserted = true;
LastKeyInserted = m.Data[2];
var e = KeyInserted;
if (e != null)
{
e(new KeyEventArgs(LastKeyInserted));
}
m.ReceiverDescription = "Key " + LastKeyInserted + " inserted";
Logger.Info(m.ReceiverDescription);
}
else if (m.Data[1] == 0x00)
{
IsKeyInserted = false;
var e = KeyRemoved;
if (e != null)
{
e(new KeyEventArgs(LastKeyInserted));
}
m.ReceiverDescription = "Key " + LastKeyInserted + " removed";
Logger.Info(m.ReceiverDescription);
}
}
}