Example #1
0
        private void Start()
        {
            Color color;

            serialPort.OpenPort(baudRate, dataBits, stopBits, parity, cmbPortName.Text);

            continueThread = true;
            t = new Thread(delegate()
            {
                try
                {
                    while (continueThread)
                    {
                        Thread.Sleep(REFRESHRATE);
                        color = Ambilight.Helpers.ScreenAnalysisHelper.getAverageColor();
                        serialPort.SendColorToComPort(color.R, color.G, color.B);
                        picColor.BackColor = color;
                    }
                }
                catch (ThreadInterruptedException) { continueThread = false; }
            });
            t.Start();
        }