Vibindas Koloth

Vibindas Koloth

  • NA
  • 13
  • 810

Code breaks from the loop in C# windows form

Jun 6 2017 3:52 AM
Hi Guys,
 
I'm stuck with this issue for some time and need to resolve it at the earliest. We have an ASP.NET application and C# exe developed in WinForms.Please see the details below.
 
1) The user uses the Web application to place the request for printing.
 
2) Web app then invokes the Windows exe using Application.Run and uses a third party for drawing the images and printing the PDF's.
 
3)To reduce the performance issue we are sending the requests in batches like suppose user requests for drawing and printing 35 docs, the request will be split into 4 batches of 10(i.e. 10,10,10,5) and when the first batch is being run rest of the batches will have to wait.
 
The first batch in the web app will invoke the exe using process.start and a lock are placed on the process until the first batch is finished.Exe will initiate the controls and its events for drawing and printing.This works fine when it is run in VS 2015 but once we deploy the code to IIS Express all the docs are not printed in a batch.The first batch only prints say 7 docs and then invokes the second batch to print.Not sure what is causing the issue is it anything to do with the thread but I haven't used any threads for Winforms.
 
Please advise what can be done for this.
I have attached the code blocks from the Winforms app 
 
Regards,
Vibindas 
 
 

Attachment: Code.rar

Answers (3)