Is this page helpful?

In this page

Selected Property (Device)

Summary
Indicates whether the device is currently selected.
Syntax
C#
C++/CLI
public bool Selected { get; set; } 
public: 
property bool Selected { 
   bool get(); 
   void set (    bool ); 
} 

Property Value

A value of true indicates that the device is currently selected. Otherwise, the value is false. Assignment could raise an error exception. For more information, refer to the ErrorCode.

Remarks

Indicates whether the device is currently selected.

Example
C#
Copied to clipboard
using Leadtools; 
using Leadtools.MediaStreaming; 
 
 
 
public Server _server = null; 
public bool _result = false; 
 
public void PrintCaptureDevicesExample() 
{ 
   try 
   { 
      string strDevices = ""; 
 
      // create an instance of the server object 
      _server = new Leadtools.MediaStreaming.Server(); 
 
      // retrieve a copy of the Live Streams 
      LiveStreams Streams = _server.GetLiveStreams(); 
 
      // create live stream just to enumerate the devices 
      LiveStream stream = Streams.CreateLiveStream(); 
 
      // print the capture devices to a string 
      strDevices += "--- Live Stream Devices---\n\n"; 
 
      //Get the Video Devices  
      Devices VideoDevices = stream.VideoDevices; 
 
      strDevices += string.Format("--- Video Devices (count = {0}) ---\n\n", VideoDevices.Count.ToString()); 
 
      // Print Video Devices 
      int nIndex = 0; 
      foreach (Device Device in VideoDevices) 
      { 
         strDevices += string.Format("Device[{0}]: FriendlyName = \"{1}\".\n", nIndex.ToString(), Device.FriendlyName); 
         strDevices += string.Format("Name =  \"{0}\".\n", nIndex.ToString(), Device.Name); 
         if (Device.Selected) 
            strDevices += "Selected = \"true\" \n"; 
         else 
            strDevices += "Selected = \"false\" \n"; 
 
         nIndex++; 
      } 
 
      //Get the Audio Devices  
      Devices AudioDevices = stream.AudioDevices; 
 
      strDevices += string.Format("--- Audio Devices (count = {0}) ---\n\n", AudioDevices.ToString()); 
 
      // Print Audio Devices 
      nIndex = 0; 
      foreach (Device Device in AudioDevices) 
      { 
         strDevices += string.Format("Device[{0}]: FriendlyName = \"{1}\".\n", nIndex.ToString(), Device.FriendlyName); 
         strDevices += string.Format("Name =  \"{0}\".\n", nIndex.ToString(), Device.Name); 
         if (Device.Selected) 
            strDevices += "Selected = \"true\" \n"; 
         else 
            strDevices += "Selected = \"false\" \n"; 
 
         nIndex++; 
      } 
 
      // display a message contains the Devices information string 
      MessageBox.Show(strDevices, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information); 
 
      _result = true; 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
Requirements

Target Platforms

See Also

Reference

Device Class

Device Members

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.MediaStreaming Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.