PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD21] Using a .NET assembly
[WD21] Using a .NET assembly
Iniciado por matthew.howard, 06,jul. 2017 14:32 - 9 respuestas
Publicado el 06,julio 2017 - 14:32
Hi All,

I'm trying to use a .NET assembly (Data Translation "OpenLayers.Base.dll").

I have added the .net assembly and this now shows up in the Project Explorer.

The first thing I'm trying to do is to see if any Data Translation devices are connected to the system.

So I want to use HardwareAvailable() which is in the DeviceMgr class of the assembly.

Using the following code:

hardware_available_bool is boolean

dotnet_device_manager is object OpenLayers.Base.DeviceMgr dynamic

dotnet_device_manager = new OpenLayers.Base.DeviceMgr()

hardware_available_bool = dotnet_device_manager.HardwareAvailable()

However the second line gives a syntax error for the dot between Base and DeviceMgr(). I have tried lots of different combinations with various different errors in the code and cannot think what else to try.

Assembly can be downloaded from here:

https://drive.google.com/file/d/0B9aImXqNxRxtNEpsZ3ZYeHNfT2c/view…


Any suggestions would be welcomed

Matt
Publicado el 13,julio 2017 - 09:56
So I'm still struggling with the above.

The code I have at present is :

dotnet_device_mgr is object OpenLayers.Base.DeviceMgr dynamic

dotnet_device_mgr = new OpenLayers.Base.DeviceMgr()

dotnet_device_mgr = OpenLayers.Base.Devicemgr.Get()

This produces errors on the 2nd and 3rd line, can anyone point me in the right direction?

Matt
Publicado el 13,julio 2017 - 14:13
Hi Matt,

the proble is not in how to call a .net assembly, the problem is how
this specifc assembly want to be called, and that is known through its
documentation...

As you have a problem with


dotnet_device_mgr = new OpenLayers.Base.DeviceMgr()


But are not giving us the precise error message or the documentation of
the methods in question, I'm going to GUESS that you need to create,
declare, instantiate, or otherwise initialize OpenLayers.Base BEFORE
calling OpenLayers.Base.DeviceMgr()

But once again, with the elements you are giving us, it's only a guess.

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com
Publicado el 13,julio 2017 - 15:44
Hi Fabrice,

Thank you for the response.

I think you could be write its just I cant seem to work out what I'm doing wrong (new to Windev).

Below is a link to the manual for the openlayers assembly.

https://drive.google.com/file/d/0B9aImXqNxRxtb1AtT3ZwMU4yd0E/view…

I would be very grateful if you could give it a look over and see if you can work out what I need to do.

Matt
Publicado el 13,julio 2017 - 16:18
Hi Matt,

I'm afraid I don't have the (free) time to go through a 435 pages
documentation...

However, a quick search of DeviceMgr got me to page 144, and that lead
me to believe that your code should be simply:

dotnet_device_manager is object OpenLayers.Base.DeviceMgr dynamic
dotnet_device_manager = DeviceMgr.Get()

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 7/13/2017 à 7:44 AM, Matt Howard a écrit :
Hi Fabrice,

Thank you for the response.

I think you could be write its just I cant seem to work out what I'm
doing wrong (new to Windev).

Below is a link to the manual for the openlayers assembly.

https://drive.google.com/file/d/0B9aImXqNxRxtb1AtT3ZwMU4yd0E/view…


I would be very grateful if you could give it a look over and see if you
can work out what I need to do.

Matt
Publicado el 13,julio 2017 - 17:08
Thanks again for the response.

I tried your suggestion but got the following error.

Error:The use of DeviceMgr creates an ambiguity between OpenLayers.DeviceCollection.DeviceMgr and OpenLayers.Base.DeviceMgr. Use the full name of DeviceMgr.
DT9805_Test, Global declarations of DT9805_Test, line 9, column 22

I then replaced the code dotnet_device_mgr = DeviceMgr.Get() with dotnet_device_mgr = OpenLayers.Base.DeviceMgr.Get()

and got this error

Error:The identifier 'OpenLayers' is unknown or inaccessible.
DT9805_Test, Global declarations of DT9805_Test, line 9, column 22

So unfortunately I'm no further forward.
Publicado el 13,julio 2017 - 17:29
and what about

dotnet_device_mgr = Base.DeviceMgr.Get() ?


Le 7/13/2017 à 9:08 AM, Matt Howard a écrit :
Thanks again for the response.

I tried your suggestion but got the following error.

Error:The use of DeviceMgr creates an ambiguity between
OpenLayers.DeviceCollection.DeviceMgr and OpenLayers.Base.DeviceMgr. Use
the full name of DeviceMgr.
DT9805_Test, Global declarations of DT9805_Test, line 9, column 22

I then replaced the code dotnet_device_mgr = DeviceMgr.Get() with
dotnet_device_mgr = OpenLayers.Base.DeviceMgr.Get()

and got this error
Error:The identifier 'OpenLayers' is unknown or inaccessible.
DT9805_Test, Global declarations of DT9805_Test, line 9, column 22

So unfortunately I'm no further forward.
Publicado el 17,julio 2017 - 17:07
Hi Fabrice,

I tried your suggestion of dotnet_device_mgr = Base.DeviceMgr.Get()

and get the following error: Error:The identifier 'Base' is unknown or inaccessible.
DT9805_Test, Global declarations of DT9805_Test, line 9, column 22

Seems odd something that should be so simple doesn't work.

Any other suggestions?
Publicado el 17,julio 2017 - 17:25
Hi again,

Not from the top of my head, no...

For this kind of things, I do:
- read of the documentation
- translation of the examples
- tests

WIthout all that, I canno"t help you more, I'm afraid

Best of luck

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 7/17/2017 à 9:07 AM, Matt Howard a écrit :
Hi Fabrice,

I tried your suggestion of dotnet_device_mgr = Base.DeviceMgr.Get()

and get the following error: Error:The identifier 'Base' is unknown
or inaccessible.
DT9805_Test, Global declarations of DT9805_Test, line 9, column 22

Seems odd something that should be so simple doesn't work.
Any other suggestions?
Publicado el 20,julio 2017 - 14:59
Hi Fabrice,

I got an answer from PCsoft and what I needed was:

hardware_available_bool is boolean
dotnet_device_mgr is object OpenLayers.Base.DeviceMgr dynamic
dotnet_device_mgr = "OpenLayers.Base.DeviceMgr".Get()
hardware_available_bool = dotnet_device_mgr.HardwareAvailable()

So now I can see when the device is plugged in.

Thanks for your efforts

Matt