Originally Posted by
Bulldog
Yes, I agree that a standalone method called by an event or from some other place is a solution. But let me explain a little more.
I'm introducing a test facility into a communications system. The DataReceived is coming from an instrument and what I'm doing is spoofing that data (disregarding what is actually being received and substituting it with test data, which is then sent onwards). This test data allows the system to be checked and tuned using known good data. That is easy enough to do with an 'if in test mode then send spoof data' switch inside the event.
The instrument sends data at specific times. So I'm still reliant on the instrument being connected and sending data to trigger the event. The instrument has an associated DLL (for which I have no source), which handles the comms. So what I'd ideally like to do is;
(a) Send test data on the same schedule as the instrument (done, no problem here)
(b) Trigger the event at will and send test data on an emulated schedule.
I placed my test data in a byte[] global, set a test flag in the event to use it, this gives me "mode (a)".
In order to do "mode (b)", is there a way I can manually raise the DataReceived event?