コード例 #1
0
        private void SetHeat_Click(object sender, EventArgs e)
        {
            Data.Items.Add("P");

            TCPIP  workerObject = new TCPIP();
            Thread workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "P";
            workerObject.par     = "";


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates.
            while (!workerThread.IsAlive)
            {
                ;
            }
            // Put the main thread to sleep for 1 millisecond to
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();
            Data.Items.Add(workerObject.res);
            Data.SelectedIndex = Data.Items.Count - 1;
        }
コード例 #2
0
ファイル: Control.cs プロジェクト: terris871/Miriam
        private void doHeatQuery()
        {
            TCPIP  workerObject = new TCPIP();
            Thread workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "i";
            workerObject.par     = "";

            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates.
            while (!workerThread.IsAlive)
            {
                ;
            }
            // Put the main thread to sleep for 1 millisecond to
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            string[] result = workerObject.res.Split(',');

            if (workerObject.res.Equals("ERROR"))
            {
                MessageBox.Show("Connection error");
            }
            else
            {
                AppendHeatLabel("Temperature U:" + workerObject.res.Split(',')[4] + "," + "Temperature M:" + workerObject.res.Split(',')[5]);

                System.Threading.Thread.Sleep(10000);
            }
        }
コード例 #3
0
ファイル: Debug.cs プロジェクト: miroculus/Miriam
        private void Read_Click(object sender, EventArgs e)
        {
            Data.Items.Add("R");
            TCPIP workerObject = new TCPIP();
            Thread workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "R";
            workerObject.par = "";


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates. 
            while (!workerThread.IsAlive) ;
            // Put the main thread to sleep for 1 millisecond to 
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();
            Data.Items.Add(workerObject.res);
            Data.SelectedIndex = Data.Items.Count - 1;
        }
コード例 #4
0
ファイル: Control.cs プロジェクト: terris871/Miriam
        private void doAssay()
        {
            Boolean cont = true;

            int loop = 0;

            do
            {
                DateTime current  = DateTime.Now;
                int      endCycle = current.Hour * 60 * 60 + current.Minute * 60 + current.Second;

                if (duration < endCycle)
                {
                    cont = false;
                }

                TCPIP  workerObject1 = new TCPIP();
                Thread workerThread1 = new Thread(workerObject1.sendANDreceive);

                workerObject1.command = "R";
                workerObject1.par     = "";


                // Start the worker thread.
                workerThread1.Start();

                // Loop until worker thread activates.
                while (!workerThread1.IsAlive)
                {
                    ;
                }
                // Put the main thread to sleep for 1 millisecond to
                // allow the worker thread to do some work:
                Thread.Sleep(1);

                workerThread1.Join();

                Thread.Sleep(2000);

                TCPIP  workerObject2 = new TCPIP();
                Thread workerThread2 = new Thread(workerObject2.sendANDreceive);

                workerObject2.command = "i";
                workerObject2.par     = "";


                // Start the worker thread.
                workerThread2.Start();

                // Loop until worker thread activates.
                while (!workerThread2.IsAlive)
                {
                    ;
                }
                // Put the main thread to sleep for 1 millisecond to
                // allow the worker thread to do some work:
                Thread.Sleep(1);

                workerThread2.Join();

                AppendData(loop.ToString() + "," + workerObject2.res.Split(',')[4] + "," +
                           workerObject2.res.Split(',')[5] + "," + workerObject1.res);

                string resToAppend = loop.ToString() + ",U,M,";

                AppendResult(loop.ToString() + "," + workerObject2.res.Split(',')[4] + "," +
                             workerObject2.res.Split(',')[5] + "," + workerObject1.res);

                Thread.Sleep(2000);

                Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(doHeatQuery));

                t.Start();



                Boolean timeRunning = true;



                do
                {
                    DateTime wait = DateTime.Now;
                    if (endCycle + 60 < wait.Hour * 60 * 60 + wait.Minute * 60 + wait.Second)
                    {
                        timeRunning = false;
                    }
                    Thread.Sleep(100);
                } while (timeRunning);
                loop += 1;
            } while (cont);
            MessageBox.Show("Assay ready");
        }
コード例 #5
0
ファイル: Control.cs プロジェクト: terris871/Miriam
        private void ButtonHeat_Click(object sender, EventArgs e)
        {
            // Set upper temperature

            TCPIP  workerObject = new TCPIP();
            Thread workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "U";
            workerObject.par     = CboxTempU.Text;


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates.
            while (!workerThread.IsAlive)
            {
                ;
            }
            // Put the main thread to sleep for 1 millisecond to
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            System.Threading.Thread.Sleep(2000);
            // Set middle temperature

            workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "M";
            workerObject.par     = CboxTempM.Text;


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates.
            while (!workerThread.IsAlive)
            {
                ;
            }
            // Put the main thread to sleep for 1 millisecond to
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            System.Threading.Thread.Sleep(2000);
            // Start heat
            workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "H";
            workerObject.par     = "";


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates.
            while (!workerThread.IsAlive)
            {
                ;
            }
            // Put the main thread to sleep for 1 millisecond to
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            System.Threading.Thread.Sleep(2000);
            Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(doHeatQuery));

            t.Start();
        }
コード例 #6
0
ファイル: Control.cs プロジェクト: miroculus/Miriam
        private void doAssay()
        {
            Boolean cont = true;

            int loop = 0;

            do
            {
                DateTime current = DateTime.Now;
                int endCycle = current.Hour * 60 * 60 + current.Minute * 60 + current.Second;

                if (duration < endCycle)
                {
                    cont = false;
                    
                }

                TCPIP workerObject1 = new TCPIP();
                Thread workerThread1 = new Thread(workerObject1.sendANDreceive);

                workerObject1.command = "R";
                workerObject1.par = "";


                // Start the worker thread.
                workerThread1.Start();

                // Loop until worker thread activates. 
                while (!workerThread1.IsAlive) ;
                // Put the main thread to sleep for 1 millisecond to 
                // allow the worker thread to do some work:
                Thread.Sleep(1);

                workerThread1.Join();

                Thread.Sleep(2000);

                TCPIP workerObject2 = new TCPIP();
                Thread workerThread2 = new Thread(workerObject2.sendANDreceive);

                workerObject2.command = "i";
                workerObject2.par = "";


                // Start the worker thread.
                workerThread2.Start();

                // Loop until worker thread activates. 
                while (!workerThread2.IsAlive) ;
                // Put the main thread to sleep for 1 millisecond to 
                // allow the worker thread to do some work:
                Thread.Sleep(1);

                workerThread2.Join();

                AppendData(loop.ToString() + "," + workerObject2.res.Split(',')[4] + "," +
                    workerObject2.res.Split(',')[5] + "," + workerObject1.res);

                string resToAppend = loop.ToString() + ",U,M,";
                
                AppendResult(loop.ToString() + "," + workerObject2.res.Split(',')[4] + "," +
                    workerObject2.res.Split(',')[5] + "," + workerObject1.res);

                Thread.Sleep(2000);

                Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(doHeatQuery));

                t.Start();



                Boolean timeRunning = true;



                do
                {
                    DateTime wait = DateTime.Now;
                    if (endCycle + 60 < wait.Hour * 60 * 60 + wait.Minute * 60 + wait.Second)
                    {
                        timeRunning = false;
                    }
                    Thread.Sleep(100);
                } while (timeRunning);
                loop += 1;

            } while (cont);
            MessageBox.Show("Assay ready");
        }
コード例 #7
0
ファイル: Control.cs プロジェクト: miroculus/Miriam
        private void doHeatQuery()
        {
            TCPIP workerObject = new TCPIP();
            Thread workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "i";
            workerObject.par = "";

            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates. 
            while (!workerThread.IsAlive) ;
            // Put the main thread to sleep for 1 millisecond to 
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            string[] result = workerObject.res.Split(',');

            if (workerObject.res.Equals("ERROR"))
            {
                MessageBox.Show("Connection error");
            } else
            {
                AppendHeatLabel("Temperature U:" + workerObject.res.Split(',')[4] + "," + "Temperature M:" + workerObject.res.Split(',')[5]);

                System.Threading.Thread.Sleep(10000);
            }

            

        }
コード例 #8
0
ファイル: Control.cs プロジェクト: miroculus/Miriam
        private void ButtonHeat_Click(object sender, EventArgs e)
        {
            // Set upper temperature

            TCPIP workerObject = new TCPIP();
            Thread workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "U";
            workerObject.par = CboxTempU.Text;


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates. 
            while (!workerThread.IsAlive) ;
            // Put the main thread to sleep for 1 millisecond to 
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            System.Threading.Thread.Sleep(2000);
            // Set middle temperature

            workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "M";
            workerObject.par = CboxTempM.Text;


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates. 
            while (!workerThread.IsAlive) ;
            // Put the main thread to sleep for 1 millisecond to 
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            System.Threading.Thread.Sleep(2000);
            // Start heat
            workerThread = new Thread(workerObject.sendANDreceive);

            workerObject.command = "H";
            workerObject.par = "";


            // Start the worker thread.
            workerThread.Start();

            // Loop until worker thread activates. 
            while (!workerThread.IsAlive) ;
            // Put the main thread to sleep for 1 millisecond to 
            // allow the worker thread to do some work:
            Thread.Sleep(1);

            workerThread.Join();

            System.Threading.Thread.Sleep(2000);
            Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(doHeatQuery));

            t.Start();

        }