コード例 #1
0
ファイル: Program.cs プロジェクト: nerduino/Dashboard
 public static void Main(string[] args)
 {
     var dashboardserver = new DashboardServer(999, new TestDataSource());
     dashboardserver.Log = new ConsoleLogger();
     dashboardserver.Start();
     Thread.Sleep(-1);
 }
コード例 #2
0
        protected override void OnStart(string[] args)
        {
            ConfigurationManager.RefreshSection("AppSetings");

            string logSource = ConfigurationManager.AppSettings["LogSource"];
            string logName = ConfigurationManager.AppSettings["LogName"];

            if (!EventLog.SourceExists(logSource))
            {
                EventLog.CreateEventSource(logSource, logName);
            }

            log = new EventLog { Source = logSource };

            int port;
            if (!int.TryParse(ConfigurationManager.AppSettings["ListenPort"], out port))
            {
                port = 9999;
            }

            server = new DashboardServer(port, new PrivateDataSource());
            server.Log = new EventLogger { EventLog = log };

            server.Start();
        }