Поделиться через


RadialControllerIndependentInputSource Класс

Определение

Позволяет приложению обрабатывать входные данные радиального контроллера в фоновом потоке.

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
Наследование
Object Platform::Object IInspectable RadialControllerIndependentInputSource
Атрибуты

Требования к Windows

Семейство устройств
Windows 10 Creators Update (появилось в 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (появилось в v4.0)

Примеры

Здесь мы создадим DispatcherQueue в выделенном фоновом потоке, а затем инициализируем объект RadialControllerInpdependentInputSource, который создается в фоновом потоке.

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; 

Комментарии

Вызовите DispatcherQueueController.CreateOnDedicatedThread , чтобы создать DispatcherQueue в фоновом потоке, где создается экземпляр RadialControllerIndependentInputSource. Получите доступ к этой dispatcherQueue с помощью свойства RadialControllerIndependentInputSource.DispatcherQueue .

Журнал версий

Версия Windows Версия пакета SDK Добавленная стоимость
1803 17134 DispatcherQueue

Свойства

Controller

Возвращает ссылку на устройство ввода колесика или аксессуар, например Surface Dial.

Dispatcher

Возвращает диспетчер сообщений о событиях, связанный с текущим представлением.

DispatcherQueue

Возвращает dispatcherQueue, связанную с этим RadialControllerIndependentInputSource.

Методы

CreateForView(CoreApplicationView)

Возвращает экземпляр RadialControllerIndependentInputSource для текущего CoreWindow запущенного приложения.

Применяется к