58 lines
1.1 KiB
C#
58 lines
1.1 KiB
C#
using System.Windows;
|
|
using SoundCapture;
|
|
|
|
namespace GuitarNoteNameTutor
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for SelectDevice.xaml
|
|
/// </summary>
|
|
public partial class SelectDevice
|
|
{
|
|
SoundCaptureDevice[] _devices;
|
|
|
|
public SoundCaptureDevice SelectedDevice
|
|
{
|
|
get { return _devices[devicesListBox.SelectedIndex]; }
|
|
}
|
|
|
|
public SelectDevice()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void LoadDevices()
|
|
{
|
|
devicesListBox.Items.Clear();
|
|
|
|
int defaultDeviceIndex = 0;
|
|
|
|
_devices = SoundCaptureDevice.GetDevices();
|
|
for (int i = 0; i < _devices.Length; i++)
|
|
{
|
|
devicesListBox.Items.Add(_devices[i].Name);
|
|
if (_devices[i].IsDefault)
|
|
defaultDeviceIndex = i;
|
|
}
|
|
|
|
devicesListBox.SelectedIndex = defaultDeviceIndex;
|
|
}
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
LoadDevices();
|
|
}
|
|
|
|
private void okButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
DialogResult = true;
|
|
Close();
|
|
}
|
|
|
|
private void lbi_MouseDoubleClick(object sender, RoutedEventArgs e)
|
|
{
|
|
DialogResult = true;
|
|
Close();
|
|
}
|
|
}
|
|
}
|