Using the automation interface with C# is very similar to using it within VB, apart from the obvious syntax differences between the two languages.
We do recommend you use the .Net Client interface though. If you look in the Start Menu folder for ClearSCADA, you'll notice a "Client API" shortcut. This link will take you to the documentation for the automation interface. You should start in the ClearScada.Client.Simple Namespace. The key classes to use are "Connection" and "DBObject".
However, to use the automation interface:
- When C# is running, select Project - Add Reference
- Select the COM tab
- Scroll down until you find the "Scx V6 Automation Interface" entry
- Select OK. You will see the entry added to the References section in the solution explorer (by default on the right hand side of the screen).
- Use the following code to connect to the server and create an internal analog point.
Note: You can download the free Visual C# 2005 Express Edition (along with other languages) from the Microsoft website. This can be used for commercial software development (see http://msdn.microsoft.com/en-gb/express/aa718399.aspx point 4).
Using Obj.Interface.CurrentValue for example, like you would from VB won't work from C#. This is because "Interface" is a vanilla IDispatch so you need to use late binding.
In VB.Net the compiler will do the plumbing for you automatically. In C# you currently need to use reflection manually, as shown in the example below.