Beispiel #1
0
        public void Start(out string errMsg)
        {
            // 子服务启动失败,应该不影响其他子服务
            errMsg = "";
            string err = "";

            if (!LoadConfig(out errMsg))
            {
                return;
            }

            try
            {
                // web接入服务
                if (this.runWebDataService == 1)
                {
                    webDataService = new WEBDataService();
                    webDataService.Start(out err);
                    if (webDataService.IsRuning)
                    {
                        TraceManagerForWeb.AppendDebug("web接入服务已经全部启动");
                    }
                    else
                    {
                        errMsg = "二供web接入服务启动失败:" + err;
                    }
                }
            }
            catch (Exception e) { TraceManagerForWeb.AppendErrMsg("web接入服务启动失败:" + e.Message); }

            try
            {
                // 二供报警服务
                if (this.runPumpAlarmService == 1)
                {
                    pumpAlarmService = new PumpAlarmService(Config.projectConfigPath);
                    pumpAlarmService.Start(out err);
                    if (pumpAlarmService.IsRuning)
                    {
                        LogManager.AppendInfo(ServerTypeName.PumpAlarm, "二供报警服务已经全部启动");
                    }
                    else
                    {
                        errMsg = "二供报警服务启动失败:" + err;
                    }
                }
            }
            catch (Exception e) { TraceManagerForWeb.AppendErrMsg("二供报警服务启动失败:" + e.Message); }

            IsRuning = true;
        }
Beispiel #2
0
        public void Stop()
        {
            try
            {
                //  二供报警服务
                if (this.pumpAlarmService != null)
                {
                    this.pumpAlarmService.Stop();
                    if (this.pumpAlarmService.IsRuning)
                    {
                        LogManager.AppendErrMsg(ServerTypeName.Dispatch, "二供报警服务停止失败");
                    }
                    else
                    {
                        LogManager.AppendInfo(ServerTypeName.Dispatch, "二供报警服务已经全部停止");
                    }
                    this.pumpAlarmService = null;
                }
            }
            catch (Exception e) { LogManager.AppendErrMsg(ServerTypeName.Dispatch, "二供报警服务停止失败:" + e.Message); }

            try
            {
                // web接入服务
                if (this.webDataService != null)
                {
                    this.webDataService.Stop();
                    if (this.webDataService.IsRuning)
                    {
                        LogManager.AppendErrMsg(ServerTypeName.Dispatch, "web接入服务停止失败");
                    }
                    else
                    {
                        LogManager.AppendInfo(ServerTypeName.Dispatch, "web接入服务已经全部停止");
                    }
                    this.webDataService = null;
                }
            }
            catch (Exception e) { LogManager.AppendErrMsg(ServerTypeName.Dispatch, "web接入服务停止失败:" + e.Message); }

            IsRuning = false;
        }