public void UpdateFromValues(GroupTabPage tab)
        {
            var allControls = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;
            int state       = 0;

            foreach (Control c in allControls)
            {
                if (c is ComboBox)
                {
                    ComboBox combo = (ComboBox)c;
                    switch (state)
                    {
                    case 0:
                        //Forward limit switch
                        combo.SelectedItem = LimitSwitchForward;
                        state = 1;
                        break;

                    case 1:
                        combo.SelectedItem = LimitSwitchReverse;
                        break;
                    }
                }
            }
        }
        public IControlGroup GetFromValues(GroupTabPage tab)
        {
            var allControls = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;
            int state       = 0;

            foreach (Control c in allControls)
            {
                if (c is ComboBox)
                {
                    ComboBox combo = (ComboBox)c;
                    switch (state)
                    {
                    case 0:
                        //Forward limit switch
                        LimitSwitchForward = (eModeOfOperation)combo.SelectedItem;
                        state = 1;
                        break;

                    case 1:
                        LimitSwitchReverse = (eModeOfOperation)combo.SelectedItem;
                        break;
                    }
                }
            }
            return(this);
        }
        public void UpdateFromValues(GroupTabPage tab)
        {
            var allControls = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;

            foreach (Control c in allControls)
            {
                if (c is ComboBox)
                {
                    ((ComboBox)c).SelectedItem = NeutralMode;
                }
            }
        }
        public IControlGroup GetFromValues(GroupTabPage tab)
        {
            var allControls = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;

            foreach (Control c in allControls)
            {
                if (c is ComboBox)
                {
                    NeutralMode = (eNeutralMode)((ComboBox)c).SelectedItem;
                }
            }
            return(this);
        }
        public void UpdateFromValues(GroupTabPage tab)
        {
            var allControls = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;
            int state       = 0;

            foreach (Control c in allControls)
            {
                if (c is NumericUpDown)
                {
                    NumericUpDown numeric = (NumericUpDown)c;
                    switch (state)
                    {
                    case 0:
                        //Forward limit switch
                        numeric.Value = (decimal)(pGain ?? 0);
                        state         = 1;
                        break;

                    case 1:
                        //Forward limit switch
                        numeric.Value = (decimal)(iGain ?? 0);
                        state         = 2;
                        break;

                    case 2:
                        //Forward limit switch
                        numeric.Value = (decimal)(dGain ?? 0);
                        state         = 3;
                        break;

                    case 3:
                        //Forward limit switch
                        numeric.Value = (decimal)(fGain ?? 0);
                        state         = 4;
                        break;

                    case 4:
                        //Forward limit switch
                        numeric.Value = (decimal)(iZone ?? 0);
                        state         = 5;
                        break;

                    case 5:
                        //Forward limit switch
                        numeric.Value = (decimal)(clRampRate ?? 0);
                        break;
                    }
                }
            }
        }
        public IControlGroup GetFromValues(GroupTabPage tab)
        {
            var allControls  = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;
            int checkState   = 0;
            int numericState = 0;

            foreach (Control c in allControls)
            {
                if (c is CheckBox)
                {
                    CheckBox check = (CheckBox)c;
                    switch (checkState)
                    {
                    case 0:
                        //Forward limit switch
                        ForwardSoftLimitEnable = check.Checked;
                        checkState             = 1;
                        break;

                    case 1:
                        ReverseSoftLimitEnable = check.Checked;
                        break;
                    }
                }
                if (c is NumericUpDown)
                {
                    NumericUpDown numeric = (NumericUpDown)c;
                    switch (numericState)
                    {
                    case 0:
                        //Forward limit switch
                        SoftLimitForwardValue = (float)numeric.Value;
                        numericState          = 1;
                        break;

                    case 1:
                        SoftLimitReverseValue = (float)numeric.Value;
                        break;
                    }
                }
            }
            return(this);
        }
        public void UpdateFromValues(GroupTabPage tab)
        {
            var allControls  = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;
            int checkState   = 0;
            int numericState = 0;

            foreach (Control c in allControls)
            {
                if (c is CheckBox)
                {
                    CheckBox check = (CheckBox)c;
                    switch (checkState)
                    {
                    case 0:
                        //Forward limit switch
                        check.Checked = ForwardSoftLimitEnable ?? false;
                        checkState    = 1;
                        break;

                    case 1:
                        check.Checked = ReverseSoftLimitEnable ?? false;
                        break;
                    }
                }
                if (c is NumericUpDown)
                {
                    NumericUpDown numeric = (NumericUpDown)c;
                    switch (numericState)
                    {
                    case 0:
                        //Forward limit switch
                        numeric.Value = (decimal)(SoftLimitForwardValue ?? 0);
                        numericState  = 1;
                        break;

                    case 1:
                        numeric.Value = (decimal)(SoftLimitReverseValue ?? 0);
                        break;
                    }
                }
            }
        }
        public IControlGroup GetFromValues(GroupTabPage tab)
        {
            var allControls = ((TableLayoutPanel)((Panel)tab.Controls[0]).Controls[0]).Controls;
            int state       = 0;

            switch (tab.Text)
            {
            case "Slot 0":
                SlotNumber = 0;
                break;

            case "Slot 1":
                SlotNumber = 1;
                break;

            default:
                SlotNumber = -1;
                break;
            }
            foreach (Control c in allControls)
            {
                if (c is NumericUpDown)
                {
                    NumericUpDown numeric = (NumericUpDown)c;
                    switch (state)
                    {
                    case 0:
                        //Forward limit switch
                        pGain = (float)numeric.Value;
                        state = 1;
                        break;

                    case 1:
                        //Forward limit switch
                        iGain = (float)numeric.Value;
                        state = 2;
                        break;

                    case 2:
                        //Forward limit switch
                        dGain = (float)numeric.Value;
                        state = 3;
                        break;

                    case 3:
                        //Forward limit switch
                        fGain = (float)numeric.Value;
                        state = 4;
                        break;

                    case 4:
                        //Forward limit switch
                        iZone = (float)numeric.Value;
                        state = 5;
                        break;

                    case 5:
                        //Forward limit switch
                        clRampRate = (float)numeric.Value;
                        break;
                    }
                }
            }
            return(this);
        }