Working with dexterity, several time got in a situation when need to wait my dexterity code for few seconds and let other things to complete themselves. Unfortunately no trick work perfectly like opening and closing of dummy form and going through some loop or etc. It would become more complex if we don’t know exactly how much time the other process will take and finish itself.
But when there is a will there’s a way! And I have found a way and wants to share it here with everyone.I have gladly used this in many projects and always get a perfect result.Yesterday I was browsing through some website and found below questions.
I had a similar situation as the one mentioned in first link.We have a widow where user create sales orders in custom window and save them in a batch and on certain time period process them and create sales batches in sales order processes and then post them, another step in this process was to create replica invoices in the subsidiary company before they posted in Main company.Our executable program was creating sales invoices in main company and replica invoices in subsidiary company , the hard thing was that we never know how long it will take to create invoices in both main and subsidiary company, so it was difficult to handle when posting should be started after calling the .exe. After calling exe we just not doing anything and waiting for exe to give us a signal so we will start posting. And this was done by adding a small code in our exe. This project we did 6 years back and at that time we created our exe in VB6 instead of .NET. Now we do the same in .NET.
In our .exe after doing all the stuffs like creating sales batches and replica invoices we tell dexterity to now start posting, on any exception we just pop up the dexterity warning . For this purpose we created a function in dexterity.
And in our exe code we added below code.
Here we have created an object DynaPostingStart and a method . On the basis of the return value we get from our .exe to our dexterity function we decide what to do.
Another way is by using callbacks and those are cool too.I will post it later. 🙂