Skip to Content
0

Using a .NET assembly in a PB Classic app with async invocations

Jun 15, 2017 at 10:07 AM

109

avatar image

Hello, all

I have a large PB classic app, which needs to use a third party .NET assembly, which has wait/async commands in it.

Will it be even possible to use it in PB, since the UI thread would simply block it and I will never get a response?

Thank you

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

avatar image
Former Member Jun 15, 2017 at 01:47 PM
0

You could call it from a background thread (SharedObject functions).

Share
10 |10000 characters needed characters left characters exceeded
Arcady Abramov Jun 18, 2017 at 06:25 AM
0

Thank you, Roland

If this is the only option, then it is not very useful. All the calls in the .NET code are "await", i.e., as far as the main flow is concerned they are synchronous. So, there is a flow, which produces result and I need to return them to the PB program. And using Sharedobjects is very problematic for this, because the result are not returned to the main thread.

I guess, I will have to create and launch a WinForm app to use this assembly.

Does anyone know if this issue can be handled differently in the upcoming PB 2017?

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jun 19, 2017 at 04:15 PM
0

You might want to consider creating a COM wrapper for your .net assembly and then trigger a user event when your sync op is completed. You can then code this event in your Powerbuilder ole object. Make sure that this userevent is exposed. Many years ago I did something similar with MS Outlook - I needed to capture the Send event of a message.

I don't know if PB 2017 will let us consume .net assemblies directly without the need for COM wrappers. Chris P might have a definite answer.

Share
10 |10000 characters needed characters left characters exceeded