SoftingIndustrial / OPC-Classic-SDK

Softing OPC Classic SDK
https://industrial.softing.com/de/produkte/opc-ua-und-opc-classic-sdks.html
MIT License
53 stars 22 forks source link

Demo Client is missing files and has compile errors #20

Open sla89 opened 9 months ago

sla89 commented 9 months ago

Hey there,

thank you for sharing your code!

I just wanted to build the Demo Client solution at development\NET\samples\client\Demo Client but there are several issues when trying to do so.

  1. WinFormsUI project is missing the files Enums.cs and NativeMethods.cs in the folder Win32. They are included in the WinFormsUI.csproj file, see here Can you maybe provide those files? I have downloaded the latest version of the project from the successor but here the method ShowWindow is missing. I have just found the missing function in the history Maybe this helps you to provide the missing files.

  2. Next thing that seems to be missing is the icon.ico file within the WinFormsUI project. I solved that one by using the default icon - but it should be fixed if possible. :)

    Could not find file 'development\NET\samples\client\Demo Client\WinFormsUI\icon.ico'.
  3. After solving the above mentioned issues I get the following compile errors:

    There is no argument given that corresponds to the required formal parameter 'aType' of 'DaAddressSpaceElement.DaAddressSpaceElement(EnumAddressSpaceElementType, string, string, string, uint, DaSession)' DemoClient2.0   C:\Dev\opc-classic\sdk\development\NET\samples\client\Demo Client\CS\TabControls\AddressSpaceControl.cs 891

    which I would fix like this

    //previous
    DaAddressSpaceElement daAddressSpaceElement = new DaAddressSpaceElement();
    //fix
    DaAddressSpaceElement daAddressSpaceElement = new DaAddressSpaceElement(EnumAddressSpaceElementType.BRANCH, String.Empty, string.Empty, string.Empty, 0, null);

And the following two

There is no argument given that corresponds to the required formal parameter 'executionOptions' of 'DaSession.Browse(string, string, DaAddressSpaceElementBrowseOptions, out DaAddressSpaceElement[], ExecutionOptions)'    DemoClient2.0   C:\Dev\opc-classic\sdk\development\NET\samples\client\Demo Client\CS\DockWindows\MainWindow.cs  

There is no argument given that corresponds to the required formal parameter 'executionOptions' of 'DaSession.Browse(string, string, DaAddressSpaceElementBrowseOptions, out DaAddressSpaceElement[], ExecutionOptions)'    DemoClient2.0   C:\Dev\opc-classic\sdk\development\NET\samples\client\Demo Client\CS\DockWindows\MainWindow.cs

which I would fix like this

// previous code´
daSession.Browse(itemName, browseOptionsLeaf, out addressSpaceElements, executionOptions))
// fixed code
daSession.Browse(((DaAddressSpaceElement)selectedNode.Tag).ItemId,
                 ((DaAddressSpaceElement)selectedNode.Tag).ItemPath,
                 browseOptionsLeaf,
                 out addressSpaceElements,
                 executionOptions))
  1. The Main function required attribute [STAThreadAttribute]
  2. The App.config required to be changed to only one TraceFile entry:
    //before
    <add key="TraceFile1" value="Trace1.txt"/>
    <add key="TraceFile2" value="Trace2.txt"/>
    //fix
    <add key="TraceFile" value="Trace1.txt"/>
  3. I had to manually copy the OTBux64.dll from the bin folder to the bin folder of the Demo Client. I guess here the copying may also be broken or it is connected to my settings - idk.

Now I was able to start the Demo Client.

Thank you!

BR Stefan