Agilent Technologies 86038B User Manual page 189

Photonic dispersion and loss analyzer
Table of Contents

Advertisement

Event Handling
Agilent 86038B Photonic Dispersion and Loss Analyzer, Second Edition
Connected. If this does not appear, it is most likely because
the PDLA Name is incorrect, or the PDLA itself is not
properly configured for networking (check the LAN
connection). Go to the PDLA front panel and select Help >
About. The PDLA name is on the About panel.
When the program is exited, it will disconnect from the
PDLA, leaving it free for front panel or other remote use.
Event handling is added to monitor the PDLA events. A very
useful event is a new status message. The status message is
shown on the bottom of the PDLA display, which indicates when
a sweep has begun, ended, and so on. By reflecting those
messages on the remote application, you provide invaluable
feedback to a user, particularly if they cannot see the PDLA
display.
When an event, like a new status message occurs, the PDLA
informs you by calling a method on your object. In fact, the
PDLA will call as many methods as you care to register – it just
keeps a list of functions to call, and runs through that list when
the event occurs.
Implementing events is a little more complicated because
Microsoft chose to use the Delegate mechanism as an
abstraction layer between the event source (the PDLA) and the
event consumer (your code.) So, instead of passing a reference
to your function to the pdlaClient, you pass a reference to your
function to a delegate, and then pass the delegate to the
pdlaClient.
To reiterate, you define in your object a function that you wish
to be called when an event occurs. That function has to take the
pass parameters defined by that event – you don't get to choose.
Call that function the event function. Once you have your event
function, you instantiate a delegate for that function. The
delegate you use depends on the pass parameters of the event
function. If the event function takes the generic event pass
parameters (an object reference and an EventArgs), you can use
a generic delegate. In general, the event will have customized
pass parameters and you must use the delegate class supplied
189

Advertisement

Table of Contents
loading

Table of Contents