コード例 #1
0
        private static void RunAsService(string[] args)
        {
            var testService = new TestWin32Service(args.Where(a => a != RunAsServiceFlag).ToArray());
            var serviceHost = new Win32ServiceHost(testService);

            serviceHost.Run();
        }
コード例 #2
0
        private static void RunInteractive(string[] args)
        {
            var testService = new TestWin32Service(args.Where(a => a != InteractiveFlag).ToArray());

            testService.Start(new string[0], () => { });
            Console.WriteLine("Running interactively, press enter to stop.");
            Console.ReadLine();
            testService.Stop();
        }