Share via


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 を呼び出して、RadialControllerIndependentInputSource がインスタンス化されるバックグラウンド スレッドに DispatcherQueue を作成します。 RadialControllerIndependentInputSource.DispatcherQueue プロパティを使用して、この DispatcherQueue にアクセスします。

バージョン履歴

Windows のバージョン SDK バージョン 追加された値
1803 17134 DispatcherQueue

プロパティ

Controller

ホイール入力デバイスまたは Surface Dial などのアクセサリへの参照を取得します。

Dispatcher

現在のビューに関連付けられているイベント メッセージ ディスパッチャーを取得します。

DispatcherQueue

この RadialControllerIndependentInputSource に関連付けられている DispatcherQueue を取得します。

メソッド

CreateForView(CoreApplicationView)

実行中のアプリの現在の CoreWindowRadialControllerIndependentInputSource のインスタンスを取得します。

適用対象