I have written a WPF app which is now starting to suffer. There is no real way of adding new features to it in it's current state, it has become sluggish to use. This application started as a demo and has unfortunately been sold and then expanded upon (sigh).
At first it was just lots of code all on Main. It was rapidly put together to prove a concept. The application makes API calls and gathers data once per second, the data is then reflected on the UI in a series of fancy looking widgets.
Calling the API from the Main thread once per second was locking up the UI. So this was moved into a BackgroundWorker.
In an attempt to segregate the code, UserControls were created for each widget and the Main is now an aggregation of those. The BackgroundWorker gathers data from the API and then feeds it to the widgets to update the UI.
Because of the BackgroundWorker, non of the UserControls can be directly updated (cannot access controls from a different thread), and everything uses the Dispatcher. The Dispatcher's buffer is getting added to faster than the UI can update, and the data displayed soon goes out of synch and you are looking at old information whilst the app is busy crunching more new data and queueing that on to the Dispatcher.
What would be a more suitable approach. I have some ideas, but as I am not an WPF expert I would be interested in hearing any known good ways to rewrite/refactor this app.