Professional Documents
Culture Documents
'(is app utili)es .N*' Framewor+ ,.- and t(e associated National Instruments VIS!
Common and VIS!NS
re%erences.
!ut(or; <C
Company; :igol 'ec(nologies9 Nort( !merica
Date; -=.-=.0-..
namespace WindowsForms!pplication.
>
pu&lic partial class Form. ; Form
>
pri#ate Message"asedSession m&Session; Create Message &ased session
pu&lic Form.6/
>
Initiali)eComponent6/;
?
pri#ate #oid &tn2pen@Clic+6o&Aect sender9 *#ent!rgs e/ 2pen a VIS! Session
>
string strVIS!:src B c&oVIS!:src.'e$t; Cet VIS! resource ID %rom com&o&o$
try
>
m&Session B 6Message"asedSession/:esourceManager.CetDocalManager6/.2pen6strVIS!:src/;
Instantiate and open a Message "ased VIS! Session
?
catc(6In#alidCast*$ception/
>
Message"o$.S(ow6E:esource selected must &e a message-&ased sessionE/;
?
catc(6*$ception e$p/
>
Message"o$.S(ow6e$p.Message/;
?
?
pri#ate #oid &tnClose@Clic+6o&Aect sender9 *#ent!rgs e/ Close VIS! session
>
try
>
m&Session.Dispose6/;
?
catc( 6*$ception e$p/
>
Message"o$.S(ow6e$p.Message/;
?
?
pri#ate #oid &tnWrite@Clic+6o&Aect sender9 *#ent!rgs e/
Write command to VIS! resource
>
string strWrite B t$tWrite.'e$t; Cet command %rom te$t &o$
try
>
m&Session.Write6strWrite/; Send Write command to VIS! resource
?
catc( 6*$ception e$p/
>
Message"o$.S(ow6e$p.Message/;
?
?
pri#ate #oid &tn:ead@Clic+6o&Aect sender9 *#ent!rgs e/
:ead command %rom VIS! resource
>
string str:ead B null;
try
>
str:ead B m&Session.:eadString6/; :ead string %rom VIS! resource
t$t:ead.'e$t B str:ead;
?
catc( 6*$ception e$p/
>
Message"o$.S(ow6e$p.Message/;
?
?
?
Figure 1: Project properties and references.