I am completely new to this whole topic, so hopefully someone can enlighten me.
I have a WPF interface from which I launch a DLL with the click of a button. When the button is pressed, it starts the dll asynchronously so that the user can "navigate" the user interface when the DLL does its job:
await Task.Factory.StartNew(new Action(() => strTime =
StartSync.Start(strPathFile,
licManager.idCmsMediator)));
this worked very well until I had to run this task in 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 start the dll by clicking the button, I can no longer navigate the user interface! As if it doesn't work asynchronously anymore ?? How can I run the task in STA mode, but can I still navigate the user interface?
Thanks in advance
source
share