I am quite new to this whole threading thing, so hopefully someone can enlighten me.
I have a WPF UI from which I start a DLL on the click of a button. When the button is clicked, it runs the dll asynchronously so that the user can still "navigate" the UI while the dll is performing its work:
await Task.Factory.StartNew(new Action(() => strTime =
StartSync.Start(strPathFile,
licManager.idCmsMediator)));
this worked very well until I had to run this Task on STA mode to open windows in the dll. So I changed this line using the method described in this post :
var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
await Task.Factory.StartNew(new Action(() => strTime =
StartSync.Start(strPathFile,
licManager.idCmsMediator)),
System.Threading.CancellationToken.None,
TaskCreationOptions.None, scheduler);
but now when I run the dll by clicking the button, I cannot navigate the UI anymore ! Like it is NOT running asynchronously anymore !? How can I start the task in STA mode but still be able to navigate the UI ?
Thanks in advance