Lamp 類別

定義

代表燈光裝置。

public ref class Lamp sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class Lamp final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class Lamp : System.IDisposable
Public NotInheritable Class Lamp
Implements IDisposable
繼承
Object Platform::Object IInspectable Lamp
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

使用此類別的常見案例是將手電筒筒功能新增至您的應用程式,讓使用者可在有手電筒筒的情況下手動開啟和關閉裝置的相機電筒燈。

此 Lamp API 代表的基礎裝置通常會與裝置的相機閃爍和視訊燈共用。 如果 Lamp 是共用裝置,相機使用案例會優先于基礎燈光裝置。 因此,同時使用相機會導致針對對應的 Lamp 裝置引發 AvailabilityChanged 事件,並回報裝置無法使用。

屬性

BrightnessLevel

取得或設定值,指出燈光目前的亮度等級,其中 0.0 完全關閉,1.0 是最大亮度。

Color

取得或設定燈光的色彩。

DeviceId

取得燈光裝置的 DeviceInformation 識別碼

IsColorSettable

取得值,指出您是否可以設定燈光裝置的 Color 屬性。

IsEnabled

取得或設定值,指出是否啟用燈光裝置。

方法

Close()

釋放燈光裝置。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

FromIdAsync(String)

取得 Lamp 物件,表示具有指定識別碼的燈光裝置。

GetDefaultAsync()

取得 Lamp 物件,表示裝置的預設燈光。

GetDeviceSelector()

傳回可用來列舉燈光裝置的類別選取字串。

事件

AvailabilityChanged

發生于燈光裝置的可用性變更時。

適用於

另請參閱