Bagikan melalui


RadialControllerIndependentInputSource Kelas

Definisi

Memungkinkan aplikasi untuk menangani input pengontrol radial pada utas latar belakang.

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
Warisan
Object Platform::Object IInspectable RadialControllerIndependentInputSource
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 Creators Update (diperkenalkan dalam 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v4.0)

Contoh

Di sini, kami membuat DispatcherQueue pada utas latar belakang khusus dan kemudian menginisialisasi objek RadialControllerInpdependentInputSource, yang dibuat pada utas latar belakang.

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; 

Keterangan

Panggil DispatcherQueueController.CreateOnDedicatedThread untuk membuat DispatcherQueue pada utas latar belakang tempat RadialControllerIndependentInputSource dibuat. Akses DispatcherQueue ini menggunakan properti RadialControllerIndependentInputSource.DispatcherQueue .

Riwayat versi

Versi Windows Versi SDK Nilai ditambahkan
1803 17134 DispatcherQueue

Properti

Controller

Mendapatkan referensi ke perangkat input roda atau aksesori seperti Surface Dial.

Dispatcher

Mendapatkan dispatcher pesan peristiwa yang terkait dengan tampilan saat ini.

DispatcherQueue

Mendapatkan DispatcherQueue yang terkait dengan RadialControllerIndependentInputSource ini.

Metode

CreateForView(CoreApplicationView)

Mendapatkan instans RadialControllerIndependentInputSource untuk CoreWindow aplikasi yang sedang berjalan.

Berlaku untuk