locked
8.1 - Need behavior of a task FIFO queue that can update the UI

    Question

  • I need behavior of a task FIFO queue that can update the UI.

    Background Task seems a bit overkill.

    ThreadPool is not available in 8.1.

    I was considering an implementation using ConcurrentQueue<Action> in a long running task.

    Design pattern suggestions?

    Thanks

    Wednesday, March 18, 2015 6:14 PM

Answers

  • Use the Windows Runtime's Windows.System.Threading.ThreadPool , not .Net's System.Threading.ThreadPool.

    You can use Intellisense to help find the reference if you don't explicitly fully qualify the class. Select the red-squiggled ThreadPool symbol in the editor and a lightbulb (on VS2015) or a blue box (on VS2013) widget will appear to offer fixes. Click for a dropdown or use the Ctrl+. keyboard accelerator. Here's the VS2015 version:

    See my video blog http://channel9.msdn.com/Series/Windows-Store-Developer-Solutions/Visual-Studios-Red-Squigglies for a visual overview of this feature.

    Wednesday, March 18, 2015 8:54 PM
    Moderator
  • What is the specific scenario you are trying to achieve? It is difficult to suggest a pattern without knowing what you're trying to do.

    BackgroundTasks cannot update the UI.

    ThreadPools are available for Windows Runtime apps.

    Wednesday, March 18, 2015 6:24 PM
    Moderator

All replies

  • What is the specific scenario you are trying to achieve? It is difficult to suggest a pattern without knowing what you're trying to do.

    BackgroundTasks cannot update the UI.

    ThreadPools are available for Windows Runtime apps.

    Wednesday, March 18, 2015 6:24 PM
    Moderator
  • I'm building a Universal app.

    When I search for ThreadPool in the object browser looking only at ".NET for Windows Store apps (Windows 8.1), there is nothing found.

    I have multiple producers, with a single consumer.  So I want to serialize the execution of the multiple producers in a FIFO manner.


    Wednesday, March 18, 2015 6:48 PM
  • Windows.System.Threading.ThreadPool is in the Windows Runtime, not in the .Net for Windows Store apps.

    Set the object browser to "My Solution" to get all API sets available for your solution.

    Wednesday, March 18, 2015 8:00 PM
    Moderator
  • Error 1 The type or namespace name 'ThreadPool' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?
    Wednesday, March 18, 2015 8:22 PM
  • Use the Windows Runtime's Windows.System.Threading.ThreadPool , not .Net's System.Threading.ThreadPool.

    You can use Intellisense to help find the reference if you don't explicitly fully qualify the class. Select the red-squiggled ThreadPool symbol in the editor and a lightbulb (on VS2015) or a blue box (on VS2013) widget will appear to offer fixes. Click for a dropdown or use the Ctrl+. keyboard accelerator. Here's the VS2015 version:

    See my video blog http://channel9.msdn.com/Series/Windows-Store-Developer-Solutions/Visual-Studios-Red-Squigglies for a visual overview of this feature.

    Wednesday, March 18, 2015 8:54 PM
    Moderator
  • Great!  Thank you Rob!
    Thursday, March 19, 2015 1:03 AM