All answers to related questions I've found so far are too complex. 2 - Can you suggest any further reading about multithreading and async/await in C#? msdn.microsoft.com/en-us/magazine/jj991977blog.stephencleary.com/2012/02/And the rest of Stephen Cleary's blog.All I need is to create a new task from a button click that displays a message in a textblock control. I learned my information from a combination of him and CLR via C# by Jeremy Richter.Since the back-end values are stored as Java FX properties, I tried simply binding them to the tasks are scheduled faster than the platform can run them, and so the GUI becomes sluggish and needs to time to "catch up" even after the back-end task is finished. I found a few questions on here: Logger entries translated to the UI stops being updated with time Multithreading in Java FX hangs the UI but my issue persists. I have done a lot of research, but all answers were too general and I simply couldn't get it t work.So here my (very common) problem: I have a WPF application which takes inputs from a few textboxes filled by the user and then uses that to do a lot of calculations with them.I'm getting the following exception: The application called an interface that was marshalled for a different thread. You don't need to await anything in My Method, you can ignore the warning safely in this [email protected] I don't believe it will.(Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)). The Task will run in the threadpool and marshal the results back through the Synchronization Context of the GUI thread.
Scanner scanner = new Scanner(ref lbl Cont); scanner. Control will return to the clicked handler after the Text property has been set. I am not a Win Forms developer but I do this exact thing in Xamarin all the time and have never seen it lock up the thread.I am currently writing my first program on C# and I am extremely new to the language (used to only work with C so far).It is still unclear what is "the function I want to call in a different thread". However, I have some other functions that I would like to call if the user presses different buttons.I need to clear the textbrowser of any text, however it seems as though the thread starts before the textbrowser clears itself.The application doesn't 'crash', it just turns grey when iterating through directories.When it's done, the GUI becomes responsive again. How do I know for sure it's being processed on a different thread?I need to have a computationally intensive function run in a different thread so that the GUI doesn't freeze or turn grey when it's running.I followed this example: But the GUI still freezes and turns grey. Since there may be a lot of files in one directory, the GUI will freeze as QDir Iterator goes through all of them.I'm hoping to add a progress bar, that will show the user the program is still [email protected] Penguin, please update the question in a way, that it would become clear where loop is executed.