Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var selectedDevice = comboBox1.SelectedItem as DeviceInterfaceWrapper;
            var deviceId       = selectedDevice.id;

            var aliasClass = comboBoxDeviceClass.SelectedItem as DeviceClassWrapper;
            var alias      = CfgMgr32.GetDeviceInterfaceAlias(deviceId, aliasClass.deviceClass);
            var enabled    = CfgMgr32.GetDeviceInterfacePropertyEnabled(alias);

            if (enabled.HasValue)
            {
                CfgMgr32.SetDeviceInterfacePropertyEnabled(alias, !enabled.Value);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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();
        }