State, background work & errors
The background job runner from Module 6 · State, Sessions, Background Work & Errors, as the walkthrough
video builds it: Start Import / Start Export, Cancel Job and Clear Log buttons, a progress bar, a status
label and a timestamped job log. The job runs with async / await so the page stays responsive, the
handler uses try / catch / finally, and the running job is kept in an instance field — per user — never
in a static field.
Run it
cd "LearnWisej-Samples/Foundations Course/Module 6/WisejTrainingApp"
dotnet run -f net10.0 --urls http://localhost:5086
Then open http://localhost:5086. (Visual Studio: open WisejTrainingApp.slnx, press F5.)
What to try
| Action | What you should see |
|---|---|
| Start Import | Start buttons disable, the bar and the log advance step by step, then Import completed successfully. |
| Cancel Job while it runs | Import cancelled.; the buttons reset |
| Tick Simulate Error, Start Import | the log shows the technical error; the status shows only Import failed. Please try again or contact support.; the buttons reset |
Where things live
| File | What it's for |
|---|---|
JobsWindow.cs | The handlers, RunJobAsync, SetJobRunning, LogError |
JobsWindow.Designer.cs | The layout — generated by the Designer |