示例#1
0
        public FlexControlAdvancedForm(Console c)
        {
            InitializeComponent();

            console = c;

            fc_interface = new FlexControlInterface1(c);

            comboModeA1.Items.Clear();
            comboModeA2.Items.Clear();
            comboModeB1.Items.Clear();
            comboModeB2.Items.Clear();

            comboModeADouble.Items.Clear();
            comboModeBDouble.Items.Clear();

            foreach (Control ctrl in grpButton.Controls)
            {
                if (ctrl.GetType() == typeof(ComboBoxTS))
                {
                    ComboBoxTS combo = (ComboBoxTS)ctrl;
                    combo.Items.Clear();
                }
            }

            // populate knob combobox controls
            foreach (FlexControlKnobFunction function in Enum.GetValues(typeof(FlexControlKnobFunction)))
            {
                string s = KnobFunction2String(function);
                comboModeA1.Items.Add(s);
                comboModeA2.Items.Add(s);
                comboModeB1.Items.Add(s);
                comboModeB2.Items.Add(s);
            }

            // populate button combobox controls
            foreach (FlexControlButtonFunction function in Enum.GetValues(typeof(FlexControlButtonFunction)))
            {
                string s = ButtonFunction2String(function);

                comboModeADouble.Items.Add(s);
                comboModeBDouble.Items.Add(s);

                foreach (Control ctrl in grpButton.Controls)
                {
                    if (ctrl.GetType() == typeof(ComboBoxTS))
                    {
                        ComboBoxTS combo = (ComboBoxTS)ctrl;
                        combo.Items.Add(s);
                    }
                }
            }

            SetupDefaults();

            Common.RestoreForm(this, "FlexControlAdvancedForm", false);

            comboModeA1_SelectedIndexChanged(this, EventArgs.Empty);
            comboModeA2_SelectedIndexChanged(this, EventArgs.Empty);
            comboModeB1_SelectedIndexChanged(this, EventArgs.Empty);
            comboModeB2_SelectedIndexChanged(this, EventArgs.Empty);


            fc_interface.CurrentKnobModeChanged += new FlexControlInterface1.KnobModeChanged(UpdateCurrentKnobMode);

            hlKnobA1      = new PanelHighlighter(panelModeA1);
            hlKnobA2      = new PanelHighlighter(panelModeA2);
            hlKnobB1      = new PanelHighlighter(panelModeB1);
            hlKnobB2      = new PanelHighlighter(panelModeB2);
            hlKnobADouble = new PanelHighlighter(panelModeADouble);
            hlKnobBDouble = new PanelHighlighter(panelModeBDouble);

            hlLeftSingle  = new PanelHighlighter(panelLeftSingle);
            hlLeftDouble  = new PanelHighlighter(panelLeftDouble);
            hlLeftLong    = new PanelHighlighter(panelLeftLong);
            hlMidSingle   = new PanelHighlighter(panelMidSingle);
            hlMidDouble   = new PanelHighlighter(panelMidDouble);
            hlMidLong     = new PanelHighlighter(panelMidLong);
            hlRightSingle = new PanelHighlighter(panelRightSingle);
            hlRightDouble = new PanelHighlighter(panelRightDouble);
            hlRightLong   = new PanelHighlighter(panelRightLong);
        }
 private void UpdateActiveComboBox(FlexControlInterface1.KnobMode mode)
 {
     switch (mode)
     {
         case FlexControlInterface1.KnobMode.A1:
             panelModeA1.Visible = true;
             panelModeA2.Visible = false;
             panelModeB1.Visible = false;
             panelModeADouble.Visible = true;
             panelModeBDouble.Visible = false;
             break;
         case FlexControlInterface1.KnobMode.A2:
             panelModeA2.Visible = true;
             panelModeA1.Visible = false;
             panelModeB2.Visible = false;
             panelModeADouble.Visible = true;
             panelModeBDouble.Visible = false;
             break;
         case FlexControlInterface1.KnobMode.B1:
             panelModeB1.Visible = true;
             panelModeA1.Visible = false;
             panelModeB2.Visible = false;
             panelModeADouble.Visible = false;
             panelModeBDouble.Visible = true;
             break;
         case FlexControlInterface1.KnobMode.B2:
             panelModeB2.Visible = true;
             panelModeA2.Visible = false;
             panelModeB1.Visible = false;
             panelModeADouble.Visible = false;
             panelModeBDouble.Visible = true;
             break;
     }
 }
        public FlexControlAdvancedForm(Console c)
        {
            InitializeComponent();

            console = c;

            fc_interface = new FlexControlInterface1(c);

            comboModeA1.Items.Clear();
            comboModeA2.Items.Clear();
            comboModeB1.Items.Clear();
            comboModeB2.Items.Clear();

            comboModeADouble.Items.Clear();
            comboModeBDouble.Items.Clear();

            foreach (Control ctrl in grpButton.Controls)
            {
                if (ctrl.GetType() == typeof(ComboBoxTS))
                {
                    ComboBoxTS combo = (ComboBoxTS)ctrl;
                    combo.Items.Clear();
                }
            }

            // populate knob combobox controls
            foreach (FlexControlKnobFunction function in Enum.GetValues(typeof(FlexControlKnobFunction)))
            {
                string s = KnobFunction2String(function);
                comboModeA1.Items.Add(s);
                comboModeA2.Items.Add(s);
                comboModeB1.Items.Add(s);
                comboModeB2.Items.Add(s);
            }           

            // populate button combobox controls
            foreach (FlexControlButtonFunction function in Enum.GetValues(typeof(FlexControlButtonFunction)))
            {
                string s = ButtonFunction2String(function);

                comboModeADouble.Items.Add(s);
                comboModeBDouble.Items.Add(s);

                foreach (Control ctrl in grpButton.Controls)
                {
                    if (ctrl.GetType() == typeof(ComboBoxTS))
                    {
                        ComboBoxTS combo = (ComboBoxTS)ctrl;
                        combo.Items.Add(s);
                    }
                }
            }

            SetupDefaults();

            Common.RestoreForm(this, "FlexControlAdvancedForm", false);

            comboModeA1_SelectedIndexChanged(this, EventArgs.Empty);
            comboModeA2_SelectedIndexChanged(this, EventArgs.Empty);
            comboModeB1_SelectedIndexChanged(this, EventArgs.Empty);
            comboModeB2_SelectedIndexChanged(this, EventArgs.Empty);

            
            fc_interface.CurrentKnobModeChanged += new FlexControlInterface1.KnobModeChanged(UpdateCurrentKnobMode);

            hlKnobA1 = new PanelHighlighter(panelModeA1);
            hlKnobA2 = new PanelHighlighter(panelModeA2);
            hlKnobB1 = new PanelHighlighter(panelModeB1);
            hlKnobB2 = new PanelHighlighter(panelModeB2);
            hlKnobADouble = new PanelHighlighter(panelModeADouble);
            hlKnobBDouble = new PanelHighlighter(panelModeBDouble);

            hlLeftSingle = new PanelHighlighter(panelLeftSingle);
            hlLeftDouble = new PanelHighlighter(panelLeftDouble);
            hlLeftLong = new PanelHighlighter(panelLeftLong);
            hlMidSingle = new PanelHighlighter(panelMidSingle);
            hlMidDouble = new PanelHighlighter(panelMidDouble);
            hlMidLong = new PanelHighlighter(panelMidLong);
            hlRightSingle = new PanelHighlighter(panelRightSingle);
            hlRightDouble = new PanelHighlighter(panelRightDouble);
            hlRightLong = new PanelHighlighter(panelRightLong);
        }
        private void UpdateCurrentKnobMode(FlexControlInterface1.KnobMode mode)
        {
            if (!this.Visible) return;

            current_knob_mode = mode;
            Invoke(new FlexControlInterface1.KnobModeChanged(UpdateActiveComboBox), new object[] {mode});            
        }