Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Show only
|
Search instead for
Did you mean:
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
📖HomeBack 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.
string sSystem = "MAIN";string sUid = "Eng";string sPwd= "";// Define the server object and create a new instance of itScxV6DbClient.ScxV6Server objServer = new ScxV6DbClient.ScxV6Server();// Connect to the serverobjServer.Connect(sSystem, sUid, sPwd);// Define the object and create a new internal analog pointScxV6DbClient.ScxV6Object obj = objServer.CreateObject("CPointAlgManual", "$Root");
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).
Accessing properties/methods directly
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.
// Get objectScxV6DbClient.ScxV6Object O = S.FindObject( "New Analogue Point" );// The line below doesn't work because Interface is declared in the IDL as a vanilla IDispatch, instead we need to use late-binding via Reflection// O.Interface.LoadDataValues( Values, Times, Qualities );// Instead, use reflection:// Get the Historic aggregateobject Historic = O.Interface.GetType().InvokeMember( "Historic", System.Reflection.BindingFlags.GetProperty, null,O.Interface,null );// Invoke the LoadDataValues methodif ( Historic != null ) Historic.GetType().InvokeMember( "LoadDataValues", System.Reflection.BindingFlags.InvokeMethod, null, Historic, new object[] { Values, Times, Qualities } );