P.,
No problem – but I can only offer limited advise with WPF as well.
In general, the EasyDAClient objects that you create are just a thin “façade” over the underlying engine that drives the OPC connections. You can therefore create and use multiple EasyDAClient objects, or even keep creating/”forgetting” them without much worries. If you, however, hook to the object events, and the event handler is e.g. your WPF Form that gets created and removed, then you need to take care of unhooking the event handler as well, otherwise both the EasyDAClient object and the form will stay in existence.
If you have permanent “control” functionality in your application, then such functionality (and corresponding EasyDAClient object) belongs to some class with longer lifetime than the transient user interface objects – maybe a main window, or even a separate, non-UI class.
Other functionality, such as displaying values on forms, can use EasyDAClient objects located on the actual forms.
I hope this helps. Best regards,
Zbynek Zahradnik
From: P.
Sent: Thursday, March 15, 2012 9:18 AM
To: Zbynek Zahradnik
Subject: RE: OPC.net question
Zbynek
Thanks. Can I ask you another question which probably says a lot about my lack of experience with c# development.
I am planning on creating a public class to hold the code that reads the data from the OPC Server and then exposing the values I read using public properties. I am using WPF as the user interface with only one page in memory at any one time. Would you think that the best way is to create a new instance of my OPCData class every time I open a page so that I can be sure that the comms is always monitored?
Regards
P.