Example #1
0
 public void ExitServer()
 {
     if (!Program.NeedExitServer)
     {
         this._TCPManager.Stop();
         GlobalServiceManager.showdown();
         GlobalServiceManager.destroy();
         this.Window_Closing();
         Console.WriteLine("正在尝试关闭服务器,看到服务器关闭完毕提示后回车退出系统");
         if (0 == Program.GetServerPIDFromFile())
         {
             string cmd = Console.ReadLine();
             while (this.MainDispatcherWorker.IsBusy)
             {
                 Console.WriteLine("正在尝试关闭服务器");
                 cmd = Console.ReadLine();
             }
         }
     }
 }
Example #2
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;
                    }
                }
            }
        }