Ok this this works as below
public MainWindow()
{
CheckCrawlURLs.func_StartCrawlingWaitingUrls();
}
However this doesn't work below
public MainWindow()
{
Task.Factory.StartNew(() =>
{
CheckCrawlURLs.func_StartCrawlingWaitingUrls();
});
}
The below is the executed class at both examples
public static class CheckCrawlURLs
{
public static void func_StartCrawlingWaitingUrls()
{
PublicStaticFunctions.AddMsgToEvents("Checking waiting crawling urls process started");
System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(func_CheckWaitingUrls);
dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
dispatcherTimer.Start();
}
private static void func_CheckWaitingUrls(object sender, EventArgs e)
{
PublicStaticFunctions.AddMsgToMoreCommonEvents("Checking waiting to crawl urls...");
List<string> lstStartCrawling = CrawlURLDB.func_ReturnNextCrawlLinks();
PublicStaticFunctions.AddMsgToMoreCommonEvents("Number of links to start crawlin: " + lstStartCrawling.Count);
}
}
So my questions are what is the logic here ?
At second task factory start the func_CheckWaitingUrls is not ticking.
Which one i should use ?