Lamp Lamp Lamp Lamp Class
Definition
Represents a lamp device.
public : sealed class Lamp : ILamp, IClosablepublic sealed class Lamp : ILamp, IDisposablePublic NotInheritable Class Lamp Implements ILamp, IDisposable// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
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.
Properties
BrightnessLevel BrightnessLevel BrightnessLevel 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.
public : float BrightnessLevel { get; set; }public float BrightnessLevel { get; set; }Public ReadWrite Property BrightnessLevel As float// You can use this property in JavaScript.
- Value
- float float float float
A value indicating the current brightness level of the lamp.
Color Color Color Color
Gets or sets the color of the lamp.
public : Color Color { get; set; }public Color Color { get; set; }Public ReadWrite Property Color As Color// You can use this property in JavaScript.
Remarks
The alpha channel of the color is ignored by this API.
DeviceId DeviceId DeviceId DeviceId
Gets the DeviceInformation Id for a lamp device.
public : PlatForm::String DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The DeviceInformation Id for a lamp device.
Remarks
Pass this ID to the FromIdAsync method to retrieve the associated Lamp object. Implement a handler for the DeviceWatcher.Removed event and compare the ID of the DeviceInformationUpdate argument to the ID of a Lamp object to be notified if the device becomes unavailable.
IsColorSettable IsColorSettable IsColorSettable IsColorSettable
Gets a value indicating whether you can set the Color property of the lamp device.
public : PlatForm::Boolean IsColorSettable { get; }public bool IsColorSettable { get; }Public ReadOnly Property IsColorSettable As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if you can set the Color property of the lamp; otherwise, false.
IsEnabled IsEnabled IsEnabled IsEnabled
Gets a value indicating whether the lamp device is enabled.
public : PlatForm::Boolean IsEnabled { get; set; }public bool IsEnabled { get; set; }Public ReadWrite Property IsEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if the lamp is enabled; otherwise, false.
Methods
Close() Close() Close() Close()
Releases the lamp device.
public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Dispose() Dispose() Dispose() Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()
FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)
Gets a Lamp object representing the lamp device with the specified ID.
public : static IAsyncOperation<Lamp> FromIdAsync(PlatForm::String deviceId)public static IAsyncOperation<Lamp> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of Lamp )// You can use this method in JavaScript.
- deviceId
- PlatForm::String String String String
The ID of the requested lamp device.
An asynchronous operation that returns a Lamp object upon successful completion.
Remarks
Use GetDefaultAsync to get the default lamp for a device. Enumerate lamp devices by passing the class selection string returned by the GetDeviceSelector method to the FindAllAsync or CreateWatcher method. Once retrieved, use the DeviceId property to retrieve the ID for the associated lamp.
GetDefaultAsync() GetDefaultAsync() GetDefaultAsync() GetDefaultAsync()
Gets a Lamp object representing the default lamp for the device.
public : static IAsyncOperation<Lamp> GetDefaultAsync()public static IAsyncOperation<Lamp> GetDefaultAsync()Public Static Function GetDefaultAsync() As IAsyncOperation( Of Lamp )// You can use this method in JavaScript.
An asynchronous operation that returns a Lamp object upon successful completion.
GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()
Returns the class selection string that you can use to enumerate lamp devices.
public : static PlatForm::String GetDeviceSelector()public static string GetDeviceSelector()Public Static Function GetDeviceSelector() As string// You can use this method in JavaScript.
The class selection string for lamp devices.
Remarks
You can enumerate lamp devices by passing the class selection string returned by the GetDeviceSelector method to the FindAllAsync or CreateWatcher method.
Events
AvailabilityChanged AvailabilityChanged AvailabilityChanged AvailabilityChanged
Occurs when the availability of the lamp device changes.
public : event TypedEventHandler AvailabilityChanged<Lamp, LampAvailabilityChangedEventArgs>public event TypedEventHandler AvailabilityChanged<Lamp, LampAvailabilityChangedEventArgs>Public Event AvailabilityChanged<Lamp, LampAvailabilityChangedEventArgs>// You can use this event in JavaScript.