CodeTV.AudioRendererEditor.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 currentDevice = (string)value;

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

                    vListBox.Items.Add("");

                    DsDevice[] tunDevices = DsDevice.GetDevicesOfCat(FilterCategory.AudioRendererCategory);
                    foreach (DirectShowLib.DsDevice d in tunDevices)
                        if (d.Name != null)
                            vListBox.Items.Add(d.Name);

                    vListBox.SelectedItem = currentDevice;
                    edSvc.DropDownControl(vListBox);
                    return vListBox.SelectedItem;
                }
            }

            return null;
        }