Exemplo n.º 1
0
        private void PrintDevices(string title, string[] deviceInterfaces)
        {
            var text = String.Format("PrintDevices: \"{0}\"", title);

            textBox1.AppendText(text + "\r\n");
            Debug.WriteLine(text);
            foreach (string deviceInterface in deviceInterfaces)
            {
                var name    = CfgMgr32.GetDeviceInterfacePropertyFriendlyName(deviceInterface);
                var enabled = CfgMgr32.GetDeviceInterfacePropertyEnabled(deviceInterface);
                text = String.Format("PrintDevices: (id:\"{0}\", name:\"{1}\", enabled:{2})", deviceInterface, name, enabled);
                textBox1.AppendText(text + "\r\n");
                Debug.WriteLine(text);
            }
        }
Exemplo n.º 2
0
        private void buttonRefresh_Click(object sender, EventArgs e)
        {
            var devicesInterfaces = CfgMgr32.GetDeviceInterfaces(CfgMgr32.KSCATEGORY_AUDIO);

            textBox1.Clear();
            PrintDevices("KSCATEGORY_AUDIO", devicesInterfaces);

            comboBox1.BeginUpdate();
            comboBox1.Items.Clear();
            foreach (var deviceInterface in devicesInterfaces)
            {
                var name    = CfgMgr32.GetDeviceInterfacePropertyFriendlyName(deviceInterface);
                var wrapper = new DeviceInterfaceWrapper(deviceInterface, name);
                comboBox1.Items.Add(wrapper);
            }
            comboBox1.SelectedIndex = 0;
            comboBox1.EndUpdate();
        }