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; this.returned_commmand_list.Add(rfidArg); if (this.subscriber != null) { subscriber.NewMessageArrived(); } //RaiseEvent(rfidArg._type, rfidArg._arg); }
void BackgroundThreadWork(object sender, DoWorkEventArgs e) { RFIDEventArg rfidArg = (RFIDEventArg)e.Argument; RaiseEvent(rfidArg._type, rfidArg._arg); }