RadialControllerIndependentInputSource RadialControllerIndependentInputSource RadialControllerIndependentInputSource RadialControllerIndependentInputSource RadialControllerIndependentInputSource Class

Definition

Enables an app to handle radial controller input on the background thread.

public : sealed class RadialControllerIndependentInputSource
struct winrt::Windows::UI::Input::Core::RadialControllerIndependentInputSource
public sealed class RadialControllerIndependentInputSource
Public NotInheritable Class RadialControllerIndependentInputSource
// This class does not provide a public constructor.
Attributes

Windows 10 requirements

Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Examples

Here, we create a DispatcherQueue on a dedicated background thread and then initialize a RadialControllerInpdependentInputSource object, which is created on the background thread.

public void CreateCoreIndependentInputSourceSample() 
{ 
    // Create a new thread, initialize DispatcherQueueController, 
    // and run a DispatcherQueue event loop on it. 
    _queueController =  
        DispatcherQueueController.CreateOnDedicatedThread(); 
    _queue = _queueController.DispatcherQueue;  

    // This is the first TryEnqueue() after creating the DispatcherQueue 
    // callback is guaranteed to be invoked first despite priority on the 
    // newly created thread. 
    bool isQueued = _queue.TryEnqueue( () => 
        {
            // The RadialControllerIndependentInputSource will raise events 
            // on the thread that created it.  
            radialInput = 
                RadialControllerIndependentInputSource.CreateForView(view); 
            radialInput.Controller.ButtonClicked += OnButtonClicked; 
            radialInput.Controller.ButtonHeld += OnButtonHeld; 
            radialInput.Controller.ButtonPressed += OnButtonPressed;  

            // Add RadialControllerMenuItems for this controller. 
            AddMenuItems(radialInput.Controller) 
        });         

    if (!isQueued) 
    { 
        // throw exception as this callback is enqueued. 
    } 

    // Enqueuing future tasks to this thread can be done using the DispatcherQueue 
    // property in RadialControllerIndependentInputSource.
    bool isTaskQueued = radialInput.DispatcherQueue.TryEnqueue( () => 
        { 
            // TODO. 
        }); 
}  

private DispatcherQueueController _queueController; 
private DispatcherQueue _queue; 
private RadialControllerIndependentInputSource radialInput; 

Remarks

Call DispatcherQueueController.CreateOnDedicatedThread to create the DispatcherQueue on the background thread where the RadialControllerIndependentInputSource is instantiated. Access this DispatcherQueue using the RadialControllerIndependentInputSource.DispatcherQueue property.

Version history

Windows version SDK version Value added
1803 17134 DispatcherQueue

Properties

Controller Controller Controller Controller Controller

Gets a reference to a wheel input device or accessory such as the Surface Dial.

Dispatcher Dispatcher Dispatcher Dispatcher Dispatcher

Gets the event message dispatcher associated with the current view.

DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue DispatcherQueue

Gets the DispatcherQueue associated with this RadialControllerIndependentInputSource.

Methods

CreateForView(CoreApplicationView) CreateForView(CoreApplicationView) CreateForView(CoreApplicationView) CreateForView(CoreApplicationView) CreateForView(CoreApplicationView)

Gets an instance of RadialControllerIndependentInputSource for the running app's current CoreWindow.