本文整理汇总了C#中Worker.cancelWork方法的典型用法代码示例。如果您正苦于以下问题:C# Worker.cancelWork方法的具体用法?C# Worker.cancelWork怎么用?C# Worker.cancelWork使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Worker
的用法示例。
在下文中一共展示了Worker.cancelWork方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
if (args.Length == 4 && args[3] == "run")
{
var crawler = new Crawler.CrawlerController(args[0], Int32.Parse(args[1]), args[2]);
}else if (args.Length == 0)
{
Console.WriteLine("Version {0}", Assembly.GetEntryAssembly().GetName().Version.ToString());
Console.Write("Enter the site to crawl>>");
String path = Console.ReadLine();
Console.Write("Enter the crawl level>>");
String level = Console.ReadLine();
Console.Write("Enter e-mail address to respond to>>");
String email = Console.ReadLine();
Console.WriteLine("Crawling, press \'c\' to cancel the crawl");
Debug.Assert(!String.IsNullOrWhiteSpace(path));
Debug.Assert(!String.IsNullOrWhiteSpace(level));
string[] arguments = new string[3];
arguments[0] = path;
arguments[1] = level;
arguments[2] = email;
var worker = new Worker(arguments);
do
{
while(!Console.KeyAvailable && worker.getIsBusy())
{
Thread.Sleep(100);
}
} while (Console.ReadKey(true).Key != ConsoleKey.C && worker.getIsBusy());
if(worker.getIsBusy())
{
worker.cancelWork();
}
}else
{
Console.Out.WriteLine("Correct useage:\n\nInteractive:\n\tCrawler.exe\nAutomatic:\n\tCrawler.exe <url> <crawl level> <response email address>");
Console.Read();
}
}