RadialControllerIndependentInputSource 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
可讓應用程式處理背景執行緒上的星形控制器輸入。
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
- 繼承
- 屬性
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) |
取得執行中應用程式目前CoreWindow的RadialControllerIndependentInputSource實例。 |