Ejemplo n.º 1
0
        public Form_SetCANParam(USBCAN can)
        {
            InitializeComponent();
            textBoxBTR0.Text = textBoxBTR1.Text = "";
            usbCAN           = can;

            uint device_count = USBCAN.detectCONNECT();

            if (device_count == 0xff)
            {
                MessageBox.Show("无设备连接!"); return;
            }
            int add_count = 0;

            while (device_count > 0)
            {
                device_count--;
                this.comboBoxCANIndex.Items.Add("设备" + add_count);
                add_count++;
            }

            if (usbCAN.CANIndex == 0 || usbCAN.CANIndex == 1)
            {
                comboBoxCANIndex.SelectedIndex = usbCAN.CANIndex;
                textBoxBTR0.Text = usbCAN.BTR0.ToString("X2");
                textBoxBTR1.Text = usbCAN.BTR1.ToString("X2");
            }
            CheckForIllegalCrossThreadCalls = false;
            form_setcan     = this;
            this.应用.Visible = false;
        }
Ejemplo n.º 2
0
        public Form_SetCANParam(ref Dictionary <int, USBCAN> usbcan_dictionary)
        {
            InitializeComponent();
            textBoxBTR0.Text       = textBoxBTR1.Text = "";
            this.USBCAN_dictionary = usbcan_dictionary;

            uint device_count = USBCAN.detectCONNECT();

            if (device_count == 0xff)
            {
                MessageBox.Show("无设备连接!"); return;
            }
            int add_count = 0;

            while (device_count > 0)
            {
                device_count--;
                this.comboBoxCANIndex.Items.Add("设备" + add_count);
                add_count++;
            }
            CheckForIllegalCrossThreadCalls = false;
            form_setcan           = this;
            this.buttonOK.Visible = false;
        }