示例#1
0
        public Switch(CANSignal csObjectInput)
        {
            InitializeComponent();
            csObject = csObjectInput;
            switch (csObject.DefaultValue)
            {
            case 0:
                radOff.Select();
                break;

            case 1:
                radOn.Select();
                break;

            case 2:
                radError.Select();
                break;

            case 3:
                radUnavailable.Select();
                break;

            default:
                throw new Exception("Error while decoding CANSignal:" + csObject.Name + " as a switch.");
            }
            Tuple <int, int> BitConfig = CANSignal.GetBitConfigure(csObject.BitOffset);
        }
示例#2
0
        public FrmModifySignal(CANSignal csObjectInit)
        {
            InitializeComponent();
            csObject = csObjectInit;
            //加载基础信息
            txtSignalName.Text = csObject.Name;
            txtBitLen.Text     = csObject.BitSize.ToString();
            Tuple <int, int> offsetInfo = CANSignal.GetBitConfigure(csObject.BitOffset);

            txtStartByte.Text = offsetInfo.Item1.ToString();
            txtStartBit.Text  = offsetInfo.Item2.ToString();
            //加载分类控件
            switch (csObject.sType)
            {
            case SignalType.Continuous:
                ucEdit = new SignalEditor.Continuous(csObjectInit);
                break;

            case SignalType.Discrete:

                ucEdit = new SignalEditor.Discrete(csObjectInit);
                break;

            case SignalType.DM1FaultCode:
                txtBitLen.Text    = "24";
                csObject.BitSize  = 24;
                txtBitLen.Enabled = false;
                ucEdit            = new SignalEditor.DM1FaultCode(csObjectInit);
                break;

            case SignalType.Switch:
                txtBitLen.Text    = "2";
                csObject.BitSize  = 2;
                txtBitLen.Enabled = false;
                ucEdit            = new SignalEditor.Switch(csObjectInit);
                break;

            case SignalType.UserDefined:
                ucEdit = new SignalEditor.Userdefined(csObjectInit);
                break;

            default:
                Close();
                return;
            }
            panelModifyType.Controls.Add(ucEdit);
            ucEdit.Dock = DockStyle.Fill;
        }