コード例 #1
0
 private void CreateMonitorServer()
 {
     try
     {
         mMonitorServer        = new MonitorServer();
         mMonitorServer.Debug += MonitorServer_Debug;
         mMonitorServer.Start();
     }
     catch (Exception ex)
     {
         WriteLog(LogMode.Error, string.Format("CreateMonitorServer fail.\t{0}", ex.Message));
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: chenmj201601/UMP
        static void Main(string[] args)
        {
            if (args != null && args.Length > 0)
            {
                if (args[0].ToUpper() == "C")
                {
                    //以控制台运行
                    try
                    {
                        IsConsole = true;
                        MonitorServer MonitorServer = new MonitorServer();
                        MonitorServer.Debug += MonitorServer_Debug;
                        //调试模式
                        if (args.Length > 1 && args[1].ToUpper() == "D")
                        {
                            IsDebug = true;
                        }
                        MonitorServer.Start();
                        Console.ReadLine();
                        MonitorServer.Stop();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                    return;
                }
            }
            //以Windows服务器运行
            MonitorService MonitorService = new MonitorService();

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                MonitorService
            };
            ServiceBase.Run(ServicesToRun);
        }