❔ ✅ I feel like I've gotten lost in what I'm doing right now, pls help.
public async Task DisplayUpdatedTicketsAsync(){ await UpdateTicketsAsync(); DisplayTickets(); //exception thrown here because only UI Thread may access stuff from UI}
public async Task DisplayUpdatedTicketsAsync(){ await UpdateTicketsAsync(); DisplayTickets(); //exception thrown here because only UI Thread may access stuff from UI}
Now this is the first time I ever experienced thread synchronization issues and I'm a little lost on what to do.
I found a solution but its not very conveniant so I was hoping for a different one:
public async Task DisplayUpdatedTicketsAsync(){ await UpdateTicketsAsync(); Dispatcher.Invoke(() => { DisplayTickets(); }); //here we say wait until thread XY is done with updating Tickets before we let UI thread display the updated tickets}
public async Task DisplayUpdatedTicketsAsync(){ await UpdateTicketsAsync(); Dispatcher.Invoke(() => { DisplayTickets(); }); //here we say wait until thread XY is done with updating Tickets before we let UI thread display the updated tickets}