public Task <TaskResult> Execute() { token = tokenSource.Token; return(Task.Run(() => { var result = new TaskResult { StartTime = DateTime.Now }; try { SeasonStatsAnalyzer analyzer = new SeasonStatsAnalyzer(); analyzer.RunAnalyzing(); StandingTableAnalyzer analyzer2 = new StandingTableAnalyzer(); analyzer2.RunAnalyzing(); result.UpdateDb = true; } catch (Exception ex) { result.IsFailed = true; result.FailedReason = ex.Message; } result.IsFailed = false; result.EndTime = DateTime.Now; return result; }, token)); }
static void TestSeasonStatsAnalyzer() { var analyzer = new SeasonStatsAnalyzer(); Console.WriteLine("Start SeasonStatsAnalyzer."); analyzer.RunAnalyzing(); Console.WriteLine("Stop SeasonStatsAnalyzer."); }