Changed Client manager on Server
This commit is contained in:
@@ -978,8 +978,6 @@ public static class ThreadsFunctions
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
if (ServerStartupConfig.AutoOpenCmsClient)
|
||||
StartCMSClient(null);
|
||||
|
||||
|
||||
if(NcConfig.NcVendor == NC_VENDOR.FANUC || NcConfig.NcVendor == NC_VENDOR.OSAI)
|
||||
@@ -994,11 +992,15 @@ public static class ThreadsFunctions
|
||||
// cmsError = toolTable.RestoreTableLock();
|
||||
}
|
||||
}
|
||||
|
||||
// Start/Restart NC threads
|
||||
ThreadsHandler.StartWorkers();
|
||||
if (!cmsError.IsError())
|
||||
{
|
||||
if (ServerStartupConfig.AutoOpenCmsClient)
|
||||
StartCMSClient();
|
||||
|
||||
reconnectionIsRunning = false;
|
||||
// Start/Restart NC threads
|
||||
ThreadsHandler.StartWorkers();
|
||||
reconnectionIsRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void RestoreConnection()
|
||||
@@ -1163,22 +1165,38 @@ public static class ThreadsFunctions
|
||||
|
||||
return sleep;
|
||||
}
|
||||
public static void StartCMSClient(string url)
|
||||
public static void StartCMSClient()
|
||||
{
|
||||
//Setup the Path Variable
|
||||
string CMSClientPath = "";
|
||||
if (!ClientIsRunning())
|
||||
{
|
||||
// Check if the system is 64/32 bit
|
||||
if (Environment.Is64BitOperatingSystem && File.Exists(CLIENT_PATH_64))
|
||||
CMSClientPath = CLIENT_PATH_64;
|
||||
else if (File.Exists(CLIENT_PATH_86))
|
||||
CMSClientPath = CLIENT_PATH_86;
|
||||
|
||||
if (!String.IsNullOrEmpty(CMSClientPath))
|
||||
Process.Start(CMSClientPath, url);
|
||||
ThreadsHandler.StartClient = new Thread(() => clientProcess());
|
||||
ThreadsHandler.StartClient.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private static void clientProcess()
|
||||
{
|
||||
string CMSClientPath = "";
|
||||
// Check if the system is 64/32 bit
|
||||
if (Environment.Is64BitOperatingSystem && File.Exists(CLIENT_PATH_64))
|
||||
CMSClientPath = CLIENT_PATH_64;
|
||||
else if (File.Exists(CLIENT_PATH_86))
|
||||
CMSClientPath = CLIENT_PATH_86;
|
||||
|
||||
if (!String.IsNullOrEmpty(CMSClientPath))
|
||||
{
|
||||
Process pr = Process.Start(CMSClientPath, null);
|
||||
|
||||
if (ServerStartupConfig.AutoOpenCmsClient)
|
||||
{
|
||||
pr.WaitForExit();
|
||||
MessageServices.Current.Publish(SEND_STOP_SERVER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ClientIsRunning()
|
||||
{
|
||||
Process[] p = Process.GetProcessesByName(CLIENT_EXE_NAME_NOEXT);
|
||||
|
||||
Reference in New Issue
Block a user