public void Shutdown() { lock (action_lock) { if (isInitialized) { CoolerMasterSDK.EnableLedControl(false); isInitialized = false; } } }
public void Shutdown() { lock (action_lock) { foreach (var device in InitializedDevices) { CoolerMasterSDK.EnableLedControl(false, device); } CoolerMasterSDK.EnableLedControl(false); CoolerMasterSDK.SetControlDevice(CoolerMasterSDK.DEVICE_INDEX.None); InitializedDevices.Clear(); isInitialized = false; } }
protected bool SwitchToDevice(CoolerMasterSDK.DEVICE_INDEX device) { if (CurrentDevice == device) { return(true); } bool init = false; CoolerMasterSDK.SetControlDevice(device); CurrentDevice = device; if (CoolerMasterSDK.IsDevicePlug() && CoolerMasterSDK.EnableLedControl(true)) { init = true; } return(init); }
//private Color peripheral_Color = Color.Black; //Previous data //private CoolerMasterSDK.KEY_COLOR[,] previous_key_colors = new CoolerMasterSDK.KEY_COLOR[CoolerMasterSDK.MAX_LED_ROW, CoolerMasterSDK.MAX_LED_COLUMN]; //private Color previous_peripheral_Color = Color.Black; public bool Initialize() { lock (action_lock) { if (!isInitialized) { try { CoolerMasterSDK.SetControlDevice(CoolerMasterSDK.DEVICE_INDEX.DEV_MKeys_L); if (CoolerMasterSDK.IsDevicePlug() && CoolerMasterSDK.EnableLedControl(true)) { isInitialized = true; return(true); } else { CoolerMasterSDK.SetControlDevice(CoolerMasterSDK.DEVICE_INDEX.DEV_MKeys_S); if (CoolerMasterSDK.IsDevicePlug() && CoolerMasterSDK.EnableLedControl(true)) { isInitialized = true; return(true); } else { Global.logger.LogLine("Cooler Master device control could not be initialized", Logging_Level.Error); isInitialized = false; return(false); } } } catch (Exception exc) { Global.logger.LogLine("There was an error initializing Cooler Master SDK.\r\n" + exc.Message, Logging_Level.Error); return(false); } } return(isInitialized); } }