المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Drop Down List Issue



C# Programming
06-02-2009, 02:23 AM
I have part of my app which enumerates all video camera devices present and presents them in a drop down list. I have two Logitech web cams which have the same name, but when I click on the drop down button, only one of the cameras are listed. How do I make it so that both are displayed? If possible, how can I add a number or ideally a port number to differentiate the two instances of the web cams?

This is my code:


public MainForm()
{

InitializeComponent();

// collect cameras list

try
{
// enumerate video devices
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);



if (videoDevices.Count == 0)
throw new ApplicationException();



// add all devices to combo
foreach (FilterInfo device in videoDevices)
{

camerasComboLeft.Items.Add(device.Name);
camerasComboRight.Items.Add(device.Name);
}



camerasComboLeft.SelectedIndex = 0;
camerasComboRight.SelectedIndex = 0;
}


catch (ApplicationException)
{

camerasComboLeft.Items.Add("You ain't got no LEFT CAMERA son!");
camerasComboRight.Items.Add("You ain't got no RIGHT CAMERA son!");

videoDevices = null;

}


EnableConnectionControls(false);


}

.... rest of the app