Exemplo n.º 1
0
        private void CheckBoundProcess()
        {
            string boundExe = this.deviceSettings.BoundExe;

            Console.WriteLine(String.IsNullOrWhiteSpace(boundExe) == false);
            if (String.IsNullOrWhiteSpace(boundExe) == false)
            {
                string activeProcessFileName = (ActiveProcess.GetActiveProcessFileName() + ".exe").ToLower();
                if (activeProcessFileName != lastActiveProcess)
                {
                    if (boundExe != null && this.ledControlEnabled == true)
                    {
                        // Only do this when "this.ledControlEnabled" is True
                        Console.WriteLine(activeProcessFileName + " | " + boundExe.ToLower() + " (" + (activeProcessFileName == boundExe.ToLower()) + ")");
                        if (activeProcessFileName == boundExe.ToLower())
                        {
                            Sharp_SDK.SDK.EnableLedControl(true);
                            SetKeyColorMatrix(this.deviceSettings.SelectedDevice);
                        }
                        else
                        {
                            Sharp_SDK.SDK.EnableLedControl(false);
                        }
                    }
                    lastActiveProcess = activeProcessFileName + "";
                }
            }
            //Console.WriteLine(ActiveProcess.GetActiveProcessFileName());
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            SetSysInfoTimer();

            deviceSettings = new DeviceSettings();

            /*int maxLEDRow = Sharp_SDK.SDK.MAX_LED_ROW;
             * int maxLEDColumn = Sharp_SDK.SDK.MAX_LED_COLUMN;
             * Sharp_SDK.KEY_COLOR[][] keyColors = new Sharp_SDK.KEY_COLOR[maxLEDRow][];
             * for (int i = 0; i < keyColors.Length; i++)
             * {
             *  keyColors[i] = new Sharp_SDK.KEY_COLOR[maxLEDColumn];
             * }
             * for (int i = 0; i < keyColors.Length; i++)
             * {
             *  for (int j = 0; j < keyColors[i].Length; j++)
             *  {
             *      keyColors[i][j] = new Sharp_SDK.KEY_COLOR(0, 0, 0);
             *  }
             * }
             * colorMatrix = new Sharp_SDK.COLOR_MATRIX(keyColors);*/
            //Sharp_SDK.SDK.SetControlDevice(Sharp_SDK.DEVICE_INDEX.DEV_MKeys_M_White);
            initialized                  = true;
            lastActiveProcess            = (ActiveProcess.GetActiveProcessFileName() + ".exe").ToLower();
            this.keyCallback             = KeyCallback;
            this.getKeyRowColumnCallback = GetKeyRowColumnKeyCallback;
        }