private static void MessageLoopThread() { if (_dfsvcForm == null) { _dfsvcForm = new DfsvcForm(); SystemEvents.SessionEnded += new SessionEndedEventHandler(_dfsvcForm.SessionEndedEventHandler); SystemEvents.SessionEnding += new SessionEndingEventHandler(_dfsvcForm.SessionEndingEventHandler); Application.Run(_dfsvcForm); } }