コード例 #1
0
 private void Start()
 {
     try
     {
         core = new IoTServiceCore();
         core.Start();
     }
     catch
     {
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: Jaasdsa/CityIoT
        public static void Test_core()
        {
            //Console.WriteLine("启动服务输入y,停止服务任意输入");
            //string r = Console.ReadLine();
            //if (r != "Y" && r != "y")
            //    return;
            IoTServiceCore core = new IoTServiceCore();

            core.Start();

            if (core.IsRuning)
            {
                Console.WriteLine("服务都已启动!");
            }
            else
            {
                Console.WriteLine("服务启动失败");
            }
            Console.ReadLine();
        }
コード例 #3
0
        protected override void OnStop()
        {
            try
            {
                if (core != null)
                {
                    core.Stop();
                    core = null;
                }

                if (timer != null)
                {
                    timer.Enabled = false;
                    timer.Dispose();
                    timer = null;
                }
            }
            catch
            {
            }
        }