Share via


RadialControllerIndependentInputSource Class

Definition

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

public ref class RadialControllerIndependentInputSource sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class RadialControllerIndependentInputSource final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class RadialControllerIndependentInputSource
Public NotInheritable Class RadialControllerIndependentInputSource
Inheritance
Object Platform::Object IInspectable RadialControllerIndependentInputSource
Attributes

Windows requirements

Device family
Windows 10 Creators Update (introduced in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v4.0)

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

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

Dispatcher

Gets the event message dispatcher associated with the current view.

DispatcherQueue

Gets the DispatcherQueue associated with this RadialControllerIndependentInputSource.

Methods

CreateForView(CoreApplicationView)

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

Applies to