public Task <TaskResult> Execute() { token = tokenSource.Token; return(Task.Run(() => { var result = new TaskResult { StartTime = DateTime.Now }; try { AverageRoundStatsAnalyzer analyzer = new AverageRoundStatsAnalyzer(); analyzer.RunAnalyzing(); RoundsStatsAnalyzer analyzer2 = new RoundsStatsAnalyzer(); 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 TestRoundsStatsAnalyzer() { var analyzer = new RoundsStatsAnalyzer(); Console.WriteLine("Start RoundsStatsAnalyzer."); analyzer.RunAnalyzing(); Console.WriteLine("Stop RoundsStatsAnalyzer."); }