Book a Demo

Author Topic: Server Busy Dialog  (Read 8195 times)

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Server Busy Dialog
« on: August 20, 2008, 02:02:37 am »
Hi All

I have written an Add-in which launches an external tool from within EA, the add-in then waits for the external tool to finish executing (it behaves therefore like a modal dilaog)

All works just fine, when I close the external tool, a dialog appears in EA titled "Server Busy".

Upon clicking the Retry button on this dialog, everything resumes as normal.

Is there are way to stop this dialog appearing?

Cheers
Models are great!
Correct models are even greater!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Server Busy Dialog
« Reply #1 on: August 20, 2008, 02:40:17 am »
How do you communicate with the external tool (especially, how do you determine whether it has finished)?  The "server busy" dialog makes me guess that you start a COM server (like MS Word) and call a synchronous method from within an EA event, but maybe you're doing something else altogether.

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Server Busy Dialog
« Reply #2 on: August 21, 2008, 12:31:16 am »
Hi Frank

Here is an extract of the relevant code:

System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("path to executable");
psi.WindowsStyle = System.Diagnostics.ProcessWindowStyle.Normal;
psi.UseShellExecute = false;
System.Diagnostics.Prcocess launch;
launch = System.Diagnostics.Process.Start(psi);
launch.WaitForExit();

The last line is wait suspends the add-in waiting for the external tool to complete.

Cheers

Phil
Models are great!
Correct models are even greater!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Server Busy Dialog
« Reply #3 on: August 21, 2008, 04:34:42 am »
OK Phil,

so you explicitely start a process and the WaitForExit() call seems to be the reason for the server busy dialog when the process is terminated before it's Main() routine terminates on its own accord.

Probably no easy way out of this. System.Diagnostics.Process.Start() is an asynchronous call really which just starts a process and returns, but you force synchronizity with the WaitForExit() call.

You could work asynchronously yourself by calling Start() without WaitForExit(), and setting up a timer to fire an event when launch.HasExited==true or a timout has been reached, and then check whether your process has delivered the results you need. Much more complicated, but offhand I can think of no other way to gracefully handle premature termination of the tool process.

Frank

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Server Busy Dialog
« Reply #4 on: August 22, 2008, 06:31:56 pm »
Thanks Frank, I will try that ... but for now I'll accept the server busy dialog

Models are great!
Correct models are even greater!