Exemple #1
0
 public static void Main(string[] args)
 {
     var dashboardserver = new DashboardServer(999, new TestDataSource());
     dashboardserver.Log = new ConsoleLogger();
     dashboardserver.Start();
     Thread.Sleep(-1);
 }
        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();
        }