mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
fix crash if XenCenterMain.exe fails to start
Add some more error handling and error messages.
This commit is contained in:
parent
834a5beda0
commit
ec938ed21b
@ -105,15 +105,50 @@ namespace splash_xcp_ng
|
||||
|
||||
int counter = 0;
|
||||
|
||||
while (proc == null || string.IsNullOrEmpty(proc.MainWindowTitle))
|
||||
while (proc == null)
|
||||
{
|
||||
System.Threading.Thread.Sleep(sleepMilliseconds);
|
||||
if(proc != null) proc.Refresh();
|
||||
if (proc != null) proc.Refresh();
|
||||
|
||||
counter++;
|
||||
if ((counter * sleepMilliseconds) >= max) break;
|
||||
}
|
||||
|
||||
if (proc == null)
|
||||
{
|
||||
MessageBox.Show("[ERROR] Something went wrong, program did not start in time: " + Environment.NewLine + exeFullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (proc.HasExited)
|
||||
{
|
||||
MessageBox.Show("[ERROR] Something went wrong, program stopped already: " + Environment.NewLine + exeFullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i * sleepMilliseconds <= max; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (string.IsNullOrEmpty(proc.MainWindowTitle))
|
||||
{
|
||||
System.Threading.Thread.Sleep(sleepMilliseconds);
|
||||
if (proc != null) proc.Refresh();
|
||||
|
||||
counter++;
|
||||
if ((counter * sleepMilliseconds) >= max) break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("[ERROR] Something went wrong, failed to start: " + Environment.NewLine + exeFullPath);
|
||||
Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user