static void Main(string[] args)
        {
            var crawlerService = new CrawlerService();

            crawlerService.Start();

            Console.CancelKeyPress += (sender, eventArgs) => { crawlerService.Stop(); };

            crawlerService.WhenTerminated.Wait();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: izavala/Cluster.WebCrawler
        static void Main(string[] args)
        {
            var crawlerService = new CrawlerService();

            crawlerService.Start();

            AppDomain.CurrentDomain.ProcessExit += (sender, eventArgs) =>
            {
                crawlerService.Stop().Wait(TimeSpan.FromSeconds(30));
            };

            Console.CancelKeyPress += async(sender, eventArgs) =>
            {
                await crawlerService.Stop();

                eventArgs.Cancel = true;
            };

            crawlerService.WhenTerminated.Wait();
        }