Exemplo n.º 1
0
 private void ui_login_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         chat_client.Stop();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     finally
     {
         instance = null;
         System.Environment.Exit(0);
     }
 }
Exemplo n.º 2
0
        public static void Quit(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                try
                {
                    if (mAppHost != null)
                    {
                        //EFWCoreLib.WcfFrame.ClientLinkPoolCache.Dispose();
                        ClientManage.StopHost();
                        mAppHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据服务已关闭!");
                    }
                }
                catch
                {
                    if (mAppHost != null)
                    {
                        mAppHost.Abort();
                    }
                }
                break;

            case StartType.FileService:
                try
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件传输服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Abort();
                    }
                }
                break;

            case StartType.HttpService:
                try
                {
                    if (mHttpHost != null)
                    {
                        mHttpHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "Http服务已关闭!");
                    }
                }
                catch
                {
                    if (mHttpHost != null)
                    {
                        mHttpHost.Abort();
                    }
                }
                break;

            case StartType.RouterBaseService:
                try
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Abort();
                    }
                }
                break;

            case StartType.RouterFileService:
                try
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Abort();
                    }
                }
                break;

            case StartType.SuperClient:


                UpgradeManage.Stop();
                UpgradeClient.Stop();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "升级包服务已停止");

                SuperClient.Stop();
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "超级客户端已关闭!");

                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StopTask();    //停止任务
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "定时任务已停止!");
                break;
            }
        }