static void Main(string[] args) { Utils.LoggingUtils.DefaultLogger = new Utils.DatabaseLogger(LogonTracerLib.LogonTracerConfig.Instance.ConnectionString); _logonTracerWorker = new LogonTracerWorker(); _logonTracerWorker.Initialize(); _logonTracerWorker.RegisterSessions(); Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch); //var service = new LogonTracer.LogonTracer(); //service.CanHandleSessionChangeEvent = true; //ServiceBase[] servicesToRun = new ServiceBase[] { service }; //if (Environment.UserInteractive) //{ // Console.CancelKeyPress += (x, y) => service.Stop(); // service.Start(); // Console.WriteLine("Sevice Start"); // Console.ReadKey(); // service.Stop(); // Console.WriteLine("Service Stop"); //} string command = Console.ReadLine(); if (command == "r") { _logonTracerWorker.RegisterSessions(); } else { _logonTracerWorker.StopWatching(); } }
private void startToolStripMenuItem_Click(object sender, EventArgs e) { //_logonTracerWorker = new LogonTracerWorker(); _logonTracerWorker.RegisterSessions(); Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch); }
private void DoWork() { _logonTracerWorker = new LogonTracerWorker(); _logonTracerWorker.Initialize(); _logonTracerWorker.RegisterSessions(); }
protected override void OnStart(string[] args) { _logonTracerWorker = new LogonTracerWorker(); _logonTracerWorker.Initialize(); _logonTracerWorker.RegisterSessions(); }