Reputation: 169
The last few days I have been working on updating a UI control from another thread and I thought I had it down with the Progress<> object.
Im running into a little issue with my Streamsocket TCP server project. I have everything up and running but I can't seem to figure out how to pass my data string back to my main UI.
Here is the jest of my program (when the client connects fire the event handler)
StreamSocketListener server = new StreamSocketListener();
server.ConnectionReceived += ClientConnection;
private async void ClientConnection(StreamSocketListener Client, StreamSocketListenerConnectionReceivedEventArgs args)
{
while (true)
{
The issue is i cant pass the ClientConnection Event Handler my Progress<> object. I have spent the last few days trying to figure out another way to do it but nothing seems to work. Anyone have any ideas? I would really appreciate it.
Upvotes: 0
Views: 205
Reputation: 7411
Your code snipplet is incomplete.
Usually you follow the MVVM pattern - then the update of the control is done outside your code via NotifyPropertyChanged on the binded variable.
Upvotes: 1