Share via


Lamp Class

Definition

Represents a lamp device.

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
Inheritance
Object Platform::Object IInspectable Lamp
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

A common scenario for using this class is adding a flashlight feature to your app that allows the user to manually turn on and off a device's camera torch light, if one is available.

The underlying device that this Lamp API represents is often shared with the device's camera flash and video light. If the Lamp is shared device, the camera use cases have priority over the underlying lamp device. Thus, simultaneous camera usage will result AvailabilityChanged event to be fired for the corresponding Lamp device, and reporting the device being unavailable.

Properties

BrightnessLevel

Gets or sets a value indicating the current brightness level of the lamp, where 0.0 is completely off and 1.0 is maximum brightness.

Color

Gets or sets the color of the lamp.

DeviceId

Gets the DeviceInformation Id for a lamp device.

IsColorSettable

Gets a value indicating whether you can set the Color property of the lamp device.

IsEnabled

Gets or sets a value indicating whether the lamp device is enabled.

Methods

Close()

Releases the lamp device.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

FromIdAsync(String)

Gets a Lamp object representing the lamp device with the specified ID.

GetDefaultAsync()

Gets a Lamp object representing the default lamp for the device.

GetDeviceSelector()

Returns the class selection string that you can use to enumerate lamp devices.

Events

AvailabilityChanged

Occurs when the availability of the lamp device changes.

Applies to

See also