CodeTV.AudioSourceEditor.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)
                {
                    ChannelAnalogic channelAnalogic = context.Instance as ChannelAnalogic;
                    GraphBuilderBase graphBuilder = MainForm.Form.GraphBuilder;
                    if (graphBuilder is GraphBuilderWDM)
                    {
                        GraphBuilderWDM graphBuilderWDM = graphBuilder as GraphBuilderWDM;
                        if (graphBuilderWDM.Crossbar != null)
                        {
                            System.Windows.Forms.ListBox vListBox = new ListBox();
                            vListBox.BorderStyle = BorderStyle.None;
                            vListBox.Click += new EventHandler(List_Click);

                            vListBox.Items.Add("");

                            //int numberOfInput = graphBuilderWDM.WDMCrossbar.GetAudioInputCount();
                            //for (int i = 0; i < numberOfInput; i++)
                            //    vListBox.Items.Add(graphBuilderWDM.WDMCrossbar.GetAudioName(i));
                            foreach (CrossbarHelper.Routing routing in graphBuilderWDM.WDMCrossbar.AudioRoutingList)
                                vListBox.Items.Add(routing.inputName);

                            vListBox.SelectedItem = (string)value;
                            edSvc.DropDownControl(vListBox);
                            return vListBox.SelectedItem;
                        }
                    }

                    return value;
                }
            }

            return null;
        }