private static void RunAsConsole(string[] args) { using (GuitarService service = new GuitarService()) { using (DebugView debugView = new DebugView()) { debugView.Show(); service.StartApp(args); while (!debugView.Stop) { Application.DoEvents(); if (debugView.Stop) { service.StopApp(); } } } } }