服务启动的基类。各个普通服务都需要继承该类并实现RunService抽象接口
Example #1
0
        /// <summary>
        /// 开始运行服务
        /// </summary>
        /// <param name="args">args</param>
        /// <param name="serviceName">服务名</param>
        /// <param name="serviceInit">服务初始化</param>
        public static void StarUpService(string args, string serviceName, ServiceInit serviceInit)
        {
            if (args == "0")
            {
                //运行在console方式下
                serviceInit.Start();
            }
            else if (args == "1")
            {
                //运行在windows服务方式下
                ServiceBase.Run(new ServiceRun(serviceInit, serviceName));
            }
            else
            {
                Debug.Assert(false);

                //运行在windows服务方式下
                ServiceBase.Run(new ServiceRun(serviceInit, serviceName));
            }
        }
Example #2
0
        /// <summary>
        /// 开始运行服务
        /// </summary>
        /// <param name="args">args</param>
        /// <param name="serviceName">服务名</param>
        /// <param name="serviceInit">服务初始化</param>
        public static void StarUpService(string args, string serviceName, ServiceInit serviceInit)
        {
            if (args == "0")
            {
                //运行在console方式下
                serviceInit.Start();
            }
            else if (args == "1")
            {
                //运行在windows服务方式下
                ServiceBase.Run(new ServiceRun(serviceInit, serviceName));
            }
            else
            {
                Debug.Assert(false);

                //运行在windows服务方式下
                ServiceBase.Run(new ServiceRun(serviceInit, serviceName));
            }
        }
Example #3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="init">服务初始化类</param>
 /// <param name="Name">服务的名字</param>
 public ServiceRun(ServiceInit init, string Name)
 {
     this.SmcInit = init;
     this.InitializeComponent(Name);
 }
Example #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="init">服务初始化类</param>
 /// <param name="Name">服务的名字</param>
 public ServiceRun(ServiceInit init, string Name)
 {
     this.SmcInit = init;
     this.InitializeComponent(Name);
 }