//print the tag code for the tag that was just lost void rfid_TagLost(object sender, TagEventArgs e) { IServiceProvider services = Services; IMessageDisplay messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay)); messageDisplay.ShowFormattedMessage("Tag {0} lost", e.Tag); }
//detach event handler...display the serial number of the detached RFID phidget void rfid_Detach(object sender, DetachEventArgs e) { IServiceProvider services = Services; IMessageDisplay messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay)); messageDisplay.ShowFormattedMessage("RFID reader {0} detached!", e.Device.SerialNumber.ToString()); }
//Error event handler...display the error description string void rfid_Error(object sender, ErrorEventArgs e) { IServiceProvider services = Services; IMessageDisplay messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay)); messageDisplay.ShowFormattedMessage(e.Description); }
//attach event handler...display the serial number of the attached RFID phidget void rfid_Attach(object sender, AttachEventArgs e) { //Get the toast message component IServiceProvider services = Services; IMessageDisplay messageDisplay = (IMessageDisplay)services.GetService(typeof(IMessageDisplay)); rfid.Antenna = true; rfid.LED = true; //pop up a message messageDisplay.ShowFormattedMessage("RFIDReader {0} attached!", e.Device.SerialNumber.ToString()); }