Exemplo n.º 1
0
        public static void Izmenenie(object ip)
        {
            TIp        sip  = (TIp)ip;
            SerialPort port = new SerialPort("COM4", 19200);

            port.Open();
            while (true)
            {
                if ((char)port.ReadChar() == '1')
                {
                    while (true)
                    {
                        sip.form.BackColor = System.Drawing.Color.Red;
                        Thread.Sleep(1000);
                        sip.form.BackColor = System.Drawing.Color.Blue;
                        Thread.Sleep(1000);
                        if (sip.button.Checked == true)
                        {
                            goto NAX;
                        }
                    }
                }
            }
            NAX :;
        }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            Thread myThread = new Thread(new ParameterizedThreadStart(Program.Izmenenie));
            TIp    qq       = new TIp();

            qq.button = this.radioButton1;
            qq.form   = this;
            myThread.Start(qq);
        }