[Connect Update 16 .NET] How do we update UI if Async or Background worker is not allowed?

I was reading a thread from a few years ago that talked about an issue I am having now, I have a WPF application that has a long running process iterating files, I would prefer to run this process as a Task in a background thread, either by using backgroundworker or async, but it appears that Microsation does not allow you to load a DGN file from non-application thread.

Is there a way to update the UI and keep it responsive during this process? In VBA there's DoEvents, it doesn't release the UI but it does allow it to be refreshed/repainted. Any options on this? 

Parents
  • In VBA there's DoEvents, it doesn't release the UI

    To supplement Jan's comprehensive answer, DoEvents has nothing to do with multi-threading.  It was invented in the days of Visual Basic (VB) in the late 20th century.

    VB is a Windows app. and uses the Win32 API.  In those early days of Windows, Icons, Mice Pointer (WIMP) development, a running app. would block windows updates.  There was no option to spawn a process, so Microsoft invented DoEventsDoEvents performs message-pumping, which processes all Windows messages currently in the message queue.  That enables other windows to update themselves.

    You can do the same with C++ using mdlSystem_pumpMessages and mdlSystem_pumpMessagesEx.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • In VBA there's DoEvents, it doesn't release the UI

    To supplement Jan's comprehensive answer, DoEvents has nothing to do with multi-threading.  It was invented in the days of Visual Basic (VB) in the late 20th century.

    VB is a Windows app. and uses the Win32 API.  In those early days of Windows, Icons, Mice Pointer (WIMP) development, a running app. would block windows updates.  There was no option to spawn a process, so Microsoft invented DoEventsDoEvents performs message-pumping, which processes all Windows messages currently in the message queue.  That enables other windows to update themselves.

    You can do the same with C++ using mdlSystem_pumpMessages and mdlSystem_pumpMessagesEx.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data