示例#1
0
        public override bool CanEnable()
        {
            CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);

            // Doesn't seem reliable but better than nothing I suppose
            return(CmSdk.IsDevicePlug());
        }
示例#2
0
        public override void DrawBitmap(Bitmap bitmap)
        {
            // Resize the bitmap
            using (var b = ImageUtilities.ResizeImage(bitmap, Width, Height))
            {
                // Create an empty matrix
                var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};

                // Map the bytes to the matix
                for (var x = 0; x < Width; x++)
                {
                    for (var y = 0; y < Height; y++)
                    {
                        var c = b.GetPixel(x, y);
                        if (c.R != 0)
                            Console.WriteLine();
                        matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B);
                    }
                }

                // Send the matrix to the keyboard
                CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
                CmSdk.SetAllLedColor(matrix);
            }
        }
示例#3
0
        public override void UpdateDevice(Bitmap bitmap)
        {
            // Create an empty matrix
            var matrix = new COLOR_MATRIX {
                KeyColor = new KEY_COLOR[6, 22]
            };

            // Get colors from the bitmap's center X and on 1/3rd and 2/3rd Y
            var x         = bitmap.Width / 2;
            var y         = bitmap.Width / 3;
            var led1Color = bitmap.GetPixel(x, y);
            var led2Color = bitmap.GetPixel(x, y * 2);

            matrix.KeyColor[0, 0] = new KEY_COLOR(led1Color.R, led1Color.G, led1Color.B);
            matrix.KeyColor[0, 1] = new KEY_COLOR(led2Color.R, led2Color.G, led2Color.B);

            // Send the matrix to the mouse
            CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_S);
            CmSdk.SetAllLedColor(matrix);
        }
示例#4
0
        public override bool TryEnable()
        {
            CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_L);

            // Doesn't seem reliable but better than nothing I suppose
            try
            {
                CanUse = CmSdk.IsDevicePlug();
                if (CanUse)
                {
                    CmSdk.EnableLedControl(true);
                }
            }
            catch (Exception)
            {
                CanUse = false;
            }

            Logger.Debug("Attempted to enable Mastermouse Pro L. CanUse: {0}", CanUse);
            return(CanUse);
        }
示例#5
0
 public override void Enable()
 {
     CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
     CmSdk.EnableLedControl(true);
 }
示例#6
0
 public override void Disable()
 {
     CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
     CmSdk.EnableLedControl(false);
     Thread.Sleep(500);
 }