CodeTV.BDACaptureDeviceEditor.EditValue C# (CSharp) Method

EditValue() public method

public EditValue ( ITypeDescriptorContext context, System provider, object value ) : object
context ITypeDescriptorContext
provider System
value object
return object
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context != null && context.Instance != null && provider != null)
            {
                edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    string currentTunerDevice = (string)value; // context.Instance;

                    System.Windows.Forms.ListBox vListBox = new ListBox();
                    vListBox.BorderStyle = BorderStyle.None;
                    vListBox.Click += new EventHandler(List_Click);

                    vListBox.Items.Add("");

                    // Enumerate BDA Source filters category and found one that can connect to the network provider
                    DsDevice[] capDevices = DsDevice.GetDevicesOfCat(FilterCategory.BDAReceiverComponentsCategory);
                    foreach (DirectShowLib.DsDevice d in capDevices)
                        if (d.Name != null)
                            vListBox.Items.Add(d.Name);

                    vListBox.SelectedItem = currentTunerDevice;
                    edSvc.DropDownControl(vListBox);

                    return vListBox.SelectedItem;
                }
            }

            return null;
        }