private void startColumnClick(object sender, RoutedEventArgs e) { if (input == null) return; if (nextColumn == -1 || boardChanged) { board.ClearPath(); nextColumn = input.GetLength(1) - 1; boardChanged = false; solver = new OnePersonGameSolver(); solver.BeginSolve(input); }; var task = new Task(() => { DisplayResult("Start solving next column..."); solver.BeginSolveNextColumn(sol => { ProcessSolution(sol, null); }); }); --nextColumn; task.Start(); }
private void startClick(object sender, RoutedEventArgs e) { if (input == null) return; Stopwatch timer = new Stopwatch(); var task = new Task<Solution>(() => { DisplayResult("Start solving..."); timer.Start(); nextColumn = -1; boardChanged = false; solver = new OnePersonGameSolver(); return solver.Solve(input); }); task.ContinueWith(result => { ProcessSolution(result.Result, timer.Elapsed); }); task.Start(); }