You can achieve what you're looking for using the Task class in . Net Here's what some code looks like that should help get you started: var task = Task.Factory. StartNew(() => YourMethodGoesHere()); task.
ContinueWith(t => UpdateYourUiInThisContinuation(), TaskScheduler. FromCurrentSynchronizationContext()); task. ContinueWith(t => HandleAnExceptionWhichTheTaskMayThrow(), TaskContinuationOptions.
OnlyOnFaulted) That will schedule the YourMethodGoesHere() to run off the UI thread. The continuation UpdateYourUiInThisContinuation() will be scheduled to run once the initial task completes, and the overload I used will force it to continue within the same synchronization context (UI thread, assuming this code is being called on the UI thread initially) The last continuation is good practice to handle any exceptions which code within the task may thrown. If you don't handle it (there are other ways other than using this continuation), you'll end up with an unhandled AggregateException.
You can achieve what you're looking for using the Task class in .Net. Here's what some code looks like that should help get you started: var task = Task.Factory. StartNew(() => YourMethodGoesHere()); task.
ContinueWith(t => UpdateYourUiInThisContinuation(), TaskScheduler. FromCurrentSynchronizationContext()); task. ContinueWith(t => HandleAnExceptionWhichTheTaskMayThrow(), TaskContinuationOptions.
OnlyOnFaulted); That will schedule the YourMethodGoesHere() to run off the UI thread. The continuation, UpdateYourUiInThisContinuation() will be scheduled to run once the initial task completes, and the overload I used will force it to continue within the same synchronization context (UI thread, assuming this code is being called on the UI thread initially). The last continuation is good practice to handle any exceptions which code within the task may thrown.
If you don't handle it (there are other ways other than using this continuation), you'll end up with an unhandled AggregateException.
Thanks! This did the trick. I handled the exceptions in my function instead.
Returning an error message as a result seems more comfy by me :) – Bogdan Marginean Sep 15 at 13:35.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.