Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WPF MVVM Threads and a Log

WPF MVVM Threads and a Log

Scheduled Pinned Locked Moved C#
wpfcsharpdesignarchitecturetutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cjb110
    wrote on last edited by
    #1

    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?

    P 1 Reply Last reply
    0
    • C cjb110

      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?

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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

      C 1 Reply Last reply
      0
      • P Pete OHanlon

        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

        C Offline
        C Offline
        cjb110
        wrote on last edited by
        #3

        ah, that looks interesting. I'll give that a go, plus it looks like it might provide a base for more larger apps. Thanks

        P 1 Reply Last reply
        0
        • C cjb110

          ah, that looks interesting. I'll give that a go, plus it looks like it might provide a base for more larger apps. Thanks

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups