WPF MVVM Threads and a Log
-
I've got a MVVM WPF app that launches multiple threads via Tasks and I'd like the app to have a basic log UI feature, that is updated asynchronously as the tasks update. I've been playing with Dispatchers, SyncContexts, various rewrites of ObsverableCollections and basically getting not very far. I've currently got a ObservableCollection, and each log entry is basically a new item, but I don't care if its just a textblock or anything else if it works:). Updating the collection works async, but it only displays on the ui once all the tasks have finished (and not all the entries are displayed even then, I have to call OnPropertyChanged again...). Can anyone point me to an working example?
-
I've got a MVVM WPF app that launches multiple threads via Tasks and I'd like the app to have a basic log UI feature, that is updated asynchronously as the tasks update. I've been playing with Dispatchers, SyncContexts, various rewrites of ObsverableCollections and basically getting not very far. I've currently got a ObservableCollection, and each log entry is basically a new item, but I don't care if its just a textblock or anything else if it works:). Updating the collection works async, but it only displays on the ui once all the tasks have finished (and not all the entries are displayed even then, I have to call OnPropertyChanged again...). Can anyone point me to an working example?
I answered a question a while back about using log4net to log to the UI. I blogged about how to do it here[^].
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier -
I answered a question a while back about using log4net to log to the UI. I blogged about how to do it here[^].
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier -
ah, that looks interesting. I'll give that a go, plus it looks like it might provide a base for more larger apps. Thanks
You're welcome.
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier