According to this
If the BackgroundWorker starts another BackgroundWorker from its
DoWork handler, then the nested BackgroundWorker doesn’t capture the
UI SynchronizationContext
However with .NET 4.0 and especially 4.5 onwards, I have seen a…
I have building an app that will help employees collect money from customers according to their balance. The app should be working on offline from internet. And when It becomes online, it should sends its collection records to the main server's…
I am trying to create a Task with the TPL. eg:
Task.Factory.StartNew(() => DoSomething());
This works fine, but now I want to start it on the gui thread.
I can cache the gui scheduler with:
_uiScheduler =…
In my library, I use a SynchronizationContext to enable me easily to raise events on the GUI thread whether the library is being used in a Windows Forms or WPF app. If my class was created on a background thread, the SynchronizationContext is null,…
We have developed a .Net component which works great for WinForms. This component is using a SynchronizationContext to raise events from the underlying threads marshalling to the UI thread (of course the component would get the…
While reviewing code last night I found this code. Of note, state is captured via the lambda which executes the generic-typed callback action.
public static void Post(TState state, Action callback){
…
I might be missing the answer somewhere, or it's something trivial, but I haven't found it.
Here's effectively what I'm trying to accomplish in code:
public static async Task CapturesContext()
{
await Task.Run(() => DoWhatever());
}
public…
This relates to my previous post here, where I asked why I should use SynchronizationContext's .Send or .Post, over just a regular .Invoke or .BeginInvoke on my main UI Form.
My issue is that the delegate I used to use with Invoke is associated with…