コード例 #1
0
        //Close the server
        public void ExitServer()
        {
            if (NeedExitServer)
            {
                return;
            }

            _TCPManager.Stop(); //Stop TCP listening, otherwise the mono can not exit normally

            //Close the Global Service Manager
            GlobalServiceManager.showdown();
            GlobalServiceManager.destroy();

            Window_Closing();

            System.Console.WriteLine("Trying to shut down the server, see the server closed after the completion of the prompts to exit the system");

            if (0 == GetServerPIDFromFile())
            {
                String cmd = System.Console.ReadLine();

                while (true)
                {
                    if (MainDispatcherWorker.IsBusy)
                    {
                        System.Console.WriteLine("Trying to shut down the server");
                        cmd = System.Console.ReadLine();
                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }