Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            //CurTempNodID = 0;
            CurPumpNodeID = 0;
            //CurTelosbID = 0;

            ComSet comset = new ComSet(ref this.ComPort1);
            comset.ShowDialog();
            if (ComPort1.IsOpen == true)
                ComPort1.DiscardInBuffer();
            ComPort1.ReadTimeout = 50;

            //comboBoxT.Sorted = true;
            comboBoxP.Sorted = true;

            string curdirectory = Directory.GetCurrentDirectory();
            string newdirectory;
            newdirectory = curdirectory + "\\Config";
            if (Directory.Exists(newdirectory))
            {
                /*
                if (File.Exists(newdirectory + "\\Temperature.config") == true)
                {
                    ReadConfig(newdirectory + "\\Temperature.config", ref Temperatureconfig, 1);
                }
                */
                if (File.Exists(newdirectory + "\\Flowrate.config") == true)
                {
                    ReadConfig(newdirectory + "\\Flowrate.config", ref Flowrateconfig, 2);
                }
                /*
                if (File.Exists(newdirectory + "\\Telosb.config") == true)
                {
                    ReadConfig(newdirectory + "\\Telosb.config", ref Telosbconfig, 3);
                }
                */
            }

            threadCom1RecvEn = true;
            threadCom1Recv = new Thread(ThreadCom1Recv);
            threadCom1Recv.Start();
        }
Exemple #2
0
 private void buttonPort1_Click(object sender, EventArgs e)
 {
     threadCom1RecvEn = false;
     if (threadCom1Recv.IsAlive)
         threadCom1Recv.Join();
     ComSet comset = new ComSet(ref this.ComPort1);
     comset.ShowDialog();
     threadCom1RecvEn = true;
     threadCom1Recv = new Thread(ThreadCom1Recv);
     threadCom1Recv.Start();
 }