private static void stopEffect() { CoolerMasterDLL.EnableLedControl(false); if (knightRider != null) { knightRider.stop(); } }
public void changeLedColor(Color effectColor, Color bgColor) { CoolerMasterDLL.SetFullLedColor(bgColor.R, bgColor.G, bgColor.B); foreach (var led in activeKeyLeds) { led.Value._color = effectColor; led.Value._bgColor = bgColor; } }
public void lightOn() { this._color = Color.FromArgb(255, this._color.R, this._color.G, this._color.B); CoolerMasterDLL.SetLedColor(this._row - 1, this._column - 1, this._color.R, this._color.G, this._color.B); if (this._autoDimToBgColor) { //if (dimmerTimer != null) { // dimmerTimer.Stop(); // dimmerTimer = null; //} lightDim(); } }
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"); } }
private void dimmerTimerEventProcessor(Object myObject, EventArgs myEventArgs) { int alphaStep = 255 / 8; if (this._color.A > 0) { int newAlpha = this._color.A - alphaStep; if (newAlpha < 0) { newAlpha = 0; } this._color = Color.FromArgb(newAlpha, this._color.R, this._color.G, this._color.B); Color nColor = CalculateSolidColorFromTransparentColor(this._color, this._bgColor); CoolerMasterDLL.SetLedColor(this._row - 1, this._column - 1, nColor.R, nColor.G, nColor.B); } else { timer.detachEventHandler(eventHandler); //dimmerTimer.Stop(); //dimmerTimer = null; } }
public void lightOff() { CoolerMasterDLL.SetLedColor(this._row - 1, this._column - 1, Color.Black.R, Color.Black.G, Color.Black.B); }