void HandleEventInNewThread(RFIDEventType type, object arg) { RFIDEventArg rfidArg = new RFIDEventArg(type, arg); BackgroundWorker backgroundWorker1 = new BackgroundWorker(); backgroundWorker1.DoWork += new DoWorkEventHandler(BackgroundThreadWork); backgroundWorker1.RunWorkerAsync(rfidArg); }
void BackgroundThreadWork(object sender, DoWorkEventArgs e) { RFIDEventArg rfidArg = (RFIDEventArg)e.Argument; RaiseEvent(rfidArg._type, rfidArg._arg); }