Back to Devexpress

CameraControl.GetDevices() Method

windowsforms-devexpress-dot-xtraeditors-dot-camera-dot-cameracontrol-8a2de2a1.md

latest3.2 KB
Original Source

CameraControl.GetDevices() Method

Returns the list of the CameraDeviceInfo objects containing information about the available video capture devices. This is a static method.

Namespace : DevExpress.XtraEditors.Camera

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public static List<CameraDeviceInfo> GetDevices()
vb
Public Shared Function GetDevices As List(Of CameraDeviceInfo)

Returns

TypeDescription
List<CameraDeviceInfo>

A list of the CameraDeviceInfo objects containing information about the available video capture devices.

|

Remarks

The static GetDevices method returns the list of the CameraDeviceInfo objects that contain system information about video capture devices on the current client machine. The returned information can be used to create CameraDevice objects that represent capture devices and can be assigned to the CameraControl.Device property or passed as a parameter to the CameraControl.Start method.

The code snippet below demonstrates how to display a context button for each found capture device and provide an end-user with the capability to start capturing video with a click on that button.

csharp
using DevExpress.XtraEditors.Camera;
using DevExpress.Data.Camera;
using DevExpress.Utils;

CameraControl cc = new CameraControl();
foreach(CameraDeviceInfo cdi in CameraControl.GetDevices()){
    ContextButton cb = new ContextButton();
    cb.Caption = cdi.Name;
    cb.Click += (o, a) => cc.Start(CameraControl.GetDevice(cdi));
    cc.ContextButtons.Add(cb);
}
vb
Imports DevExpress.XtraEditors.Camera
Imports DevExpress.Data.Camera
Imports DevExpress.Utils

Dim cc As New CameraControl()
For Each cdi As CameraDeviceInfo In CameraControl.GetDevices()
    Dim cb As New ContextButton()
    cb.Caption = cdi.Name
    cb.Click += Function(o, a) cc.Start(CameraControl.GetDevice(cdi))
    cc.ContextButtons.Add(cb)
Next

See Also

GetDevice(CameraDeviceInfo)

CameraControl Class

CameraControl Members

DevExpress.XtraEditors.Camera Namespace