Example #1
0
 public void Shutdown()
 {
     lock (action_lock)
     {
         if (isInitialized)
         {
             CoolerMasterSDK.EnableLedControl(false);
             isInitialized = false;
         }
     }
 }
Example #2
0
        private void SendColorsToKeyboard(bool forced = false)
        {
            if (Global.Configuration.devices_disable_keyboard)
            {
                return;
            }

            color_matrix.KeyColor = key_colors;
            CoolerMasterSDK.SetAllLedColor(color_matrix);
            //previous_key_colors = key_colors;
            keyboard_updated = true;
        }
Example #3
0
        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;
            }
        }
Example #4
0
        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);
        }
        public MainWindow()
        {
            SDK = new CoolerMasterSDK();

            Data = new Data();
            InitializeComponent();
            DataContext = Data;
            Timer       = new Timer
            {
                Interval  = 500,
                AutoReset = true,
                Enabled   = true
            };
            Timer.Elapsed   += Timer_Elapsed;
            Data.DLLVersion  = SDK.GetSDKVersion;
            SDK.KeyCallback += SDK_KeyCallback;
            Data.Status      = "Ready";
        }
Example #6
0
        //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);
            }
        }
Example #7
0
        private void SendColorsToKeyboard(bool forced = false)
        {
            if (Global.Configuration.devices_disable_keyboard)
            {
                return;
            }

            List <CoolerMasterSDK.DEVICE_INDEX> devices = InitializedDevices.FindAll(x => CoolerMasterSDK.Keyboards.Contains(x));

            if (devices.Count > 0)
            {
                SwitchToDevice(devices.First());
            }
            else
            {
                return;
            }

            color_matrix.KeyColor = key_colors;
            CoolerMasterSDK.SetAllLedColor(color_matrix);
            //previous_key_colors = key_colors;
            keyboard_updated = true;
        }