Wpf updating ui asynchronously original dating game episodes
My apologies were given below for not specifying that it is a wpf application and that it is my backend trying to update my GUI so yes it would be cross threading.
I think I got it working though, so thanks to all of you who did help!!! Typically in a chat app your events will come in on other threads (either dedicated socket listen threads or thread pool threads from listening code).
If you want to update the UI from an event that gets pull on some other thread you must use the dispatcher.
A useful test here is the Hey guys, sorry I didn't specify, yes it is a wpf application and yes it is cross threading. If your "backend" is in a dll then you will need to pass the UI thread Dispatcher into your object there so it can reference it.
Here the call Process() method is declared as an asynchronous method because we have declared the async keyword in front of it. Have a look at the following example to understand how to use the await keyword.
I hope you have had good experiences with C# and you already understand the concept of asynchronous technique, what it is, and what its value is in applications. This will be a quick explanation of the entire concept, then we will explain two very important keywords in the world of asynchronous programming, called async and await. If you are a senior web developer (at least 5 years in this field) then you have a lot of experience with the bad response time of web applications.
So, let's go through one small example and try to understand those concepts.
Let's create a Windows application and write the following code for it.
Void: Means nothing to return Task: It will perform one operation, a little similar to void but the difference is there.
Task In this article we have discussed the basics of asynchronous techniques, I hope you have understood the concepts.