/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { if (args.Length > 0 && args[0].ToLower() == "/console") { AllocConsole(); EventLoggerApp app = new EventLoggerApp(); app.Start(); string input = string.Empty; Console.Write("Eventlogger Console started. Type 'exit' to stop the application: "); // Wait for the user to exit the application while (input.ToLower() != "exit") { input = Console.ReadLine(); } // Stop the application. app.Stop(); } else { // Initialize and run the service ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new EventLoggerService() }; ServiceBase.Run(ServicesToRun); } }
public void DMain() { EventLoggerApp evenApp = new EventLoggerApp(); _thread = new Thread(new ThreadStart(evenApp.Start)); _thread.SetApartmentState(ApartmentState.MTA); _thread.Start(); }
protected override void OnStart(string[] args) { if (_app == null) { _app = new EventLoggerApp(); } _app.Start(); }