private static void stopEffect()
 {
     CoolerMasterDLL.EnableLedControl(false);
     if (knightRider != null)
     {
         knightRider.stop();
     }
 }
Beispiel #2
0
        private void init()
        {
            int totalLedCount = MAX_LED_COLUMN * MAX_LED_ROW;

            if (activeKeyLeds == null)
            {
                activeKeyLeds = new Dictionary <int, KeyLed>();
                for (int i = 0; i < totalLedCount; i++)
                {
                    int row    = (int)Math.Ceiling((double)(i + 1) / 22);
                    int column = (i + 1);
                    if (column > MAX_LED_COLUMN)
                    {
                        column = (i + 1) - (22 * (row - 1));
                    }
                    var keyItem = new KeyLed(row, column, effectColor, bgColor);
                    activeKeyLeds.Add(int.Parse(row.ToString() + column.ToString()), keyItem);
                }
            }

            if (timer != null)
            {
                timer.Stop();
                timer = null;
            }

            timer          = new Timer();
            timer.Tick    += new EventHandler(TimerEventProcessor);
            timer.Interval = 30;
            timer.Start();

            if (CoolerMasterDLL.IsDevicePlug())
            {
                //MessageBox.Show("Connected");
                CoolerMasterDLL.EnableLedControl(true);
                CoolerMasterDLL.SetFullLedColor(bgColor.R, bgColor.G, bgColor.B);
            }
            else
            {
                MessageBox.Show("Keyboard is not connected");
            }
        }