Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                sp = new System.IO.Ports.SerialPort(comboBox1.Text, int.Parse(textBox1.Text));
                x = new XModem(sp);
                if (x.IsOpen)
                {
                    x.DoRecieveData += new XModem._doData(x_DoRecieveData);
                    x.StateChange += new XModem._StateChange(x_StateChange);
                    tsLabel.Text = "Open SerialPort Successed!";
                }else
                    tsLabel.Text = "Open SerialPort Failed!";

            }
            catch { tsLabel.Text = "Open SerialPort Failed!"; }
        }
Пример #2
0
        private void CreateX()
        {
            try
            {
                sp = new System.IO.Ports.SerialPort(toolStripComboBox1.Text, 19200);//int.Parse(textBox1.Text));
                x = new XModem(sp);
                if (x.IsOpen)
                {
                    x.DoRecieveData += new XModem._doData(x_DoRecieveData);
                    x.StateChange += new XModem._StateChange(x_StateChange);
                    tssbCom.Text = "Open SerialPort Successed!";
                }
                else
                    tssbCom.Text = "Open SerialPort Failed!";

            }
            catch { tssbCom.Text = "Open SerialPort Failed!"; }
        }