Exemplo 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;
        }
Exemplo n.º 2
0
        private void 打开设备ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_SetCANParam formParm = new Form_SetCANParam(usbCAN);

            formParm.ShowDialog();
            if (canMenu.startDevice())
            {
                MessageBox.Show("设备打开成功");
            }
        }
        private void 设备参数ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_SetCANParam formParm = new Form_SetCANParam(ref USBCAN_dictionary);

            formParm.ShowDialog();
            for (var i = 0; i <= 7; i++)
            {
                try
                {
                    if (USBCAN_dictionary[i].startDevice())
                    {
                        textBox1.AppendText("设备" + i + "开启成功\r\n");
                    }
                    else
                    {
                        textBox1.AppendText("设备" + i + "开启失败\r\n");
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
        /*---------------------------------------------------------------------------------------------------*/
        private void 设备参数ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_SetCANParam form = new Form_SetCANParam(usbCAN);

            form.ShowDialog();
        }