Example #1
0
        protected void ClickedTestCOM(object sender, EventArgs e)
        {
            // Create a new SerialPort object with default settings.
            bool status = device.Connect(combobox_selectSerial.ActiveText);

            if (status)
            {
                textview_Debug.Buffer.Text += "\nOpened Port";
            }
            else
            {
                textview_Debug.Buffer.Text += "\nError.  Unable to open port";
            }
        }
Example #2
0
        protected void IDdiscont(object sender, EventArgs e)
        {
            if (combobox_avail.Active < 0)
            {
                return;
            }

            string port = combobox_avail.ActiveText;

            try
            {
                bool found = false;
                for (int i = 0; i < MainClass.devices.Length; i++)
                {
                    NIRSDAQ.info info = MainClass.devices[i].GetInfo();
                    if (port == info.PortName)
                    {
                        MainClass.devices[i].IDmode(true);
                        Thread.Sleep(3000);
                        MainClass.devices[i].IDmode(false);
                        found = true;
                    }
                }
                if (!found)
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(@"BTNIRS_Config.xml");
                    NIRSDAQ.Instrument.Devices.TechEn.BTnirs bTnirs = new NIRSDAQ.Instrument.Devices.TechEn.BTnirs(doc);
                    bTnirs.Connect(port);
                    bTnirs.IDmode(true);
                    Thread.Sleep(3000);
                    bTnirs.IDmode(false);
                    bTnirs.Destroy();
                }
            }
            catch { }
        }