예제 #1
0
        private void WyslijPorty_Click(object sender, EventArgs e)
        {
            int ioOut = lastIoStatus;

            for (int i = 0; i < 4; i++)
            {
                if (Outputs.GetItemChecked(i))
                {
                    ioOut |= (1 << (4 + i));
                }
                else
                {
                    ioOut &= ~(1 << (4 + i));
                }
            }

            readTimer.Stop();
            try
            {
                lock (commLock)
                {
                    spektrometr.SetPortyIO((byte)ioOut);
                }
            }
            catch (TimeoutException)
            {
                ConnectionErrors.Invoke(new Action(CountErrors));
            }
            readTimer.Start();
        }