Exemple #1
0
 private void DrawPoints(CorsairKeyboard keyboard, Color color)
 {
     if (properties.displayPoints)
     {
         Different_Platforms.CUE.Draw.LEDDrawAt(keyboard, color, calc2DPoints);
     }
 }
Exemple #2
0
        //Her tegner vi et wireframe
        private void DrawLines(CorsairKeyboard keyboard, Color color)
        {
            if (properties.displayLines)
            {
                foreach (var polyLine in polyLines)
                {
                    //Loop through polyline
                    for (int i = 0; i < polyLine.indexesInModel.Length - 1; i++)
                    {
                        //Draw line
                        Different_Platforms.CUE.Draw.LEDDrawLineAt(keyboard, color, calc2DPoints[polyLine.indexesInModel[i]], calc2DPoints[polyLine.indexesInModel[i + 1]]);
                    }
                }
            }

            if (properties.displayFaces)
            {
                foreach (var face in faces)
                {
                    //Loop through polyline in face
                    for (int i = 0; i < face.indexesInModel.Length - 1; i++)
                    {
                        //Draw line
                        Different_Platforms.CUE.Draw.LEDDrawLineAt(keyboard, color, calc2DPoints[face.indexesInModel[i]], calc2DPoints[face.indexesInModel[i + 1]]);
                    }

                    //Draw last line
                    Different_Platforms.CUE.Draw.LEDDrawLineAt(keyboard, color, calc2DPoints[face.indexesInModel[0]], calc2DPoints[face.indexesInModel[face.indexesInModel.Length - 1]]);
                }
            }
        }
Exemple #3
0
        public static void clearSpace(CorsairKeyboard keyboard)
        {
            CorsairColor nothing = new CorsairColor(0, 0, 0);

            for (char c = 'A'; c <= 'Z'; c++)
            {
                keyboard[(CorsairLedId)System.Enum.Parse(typeof(CorsairLedId), c + "")].Color = nothing;
            }

            for (int i = 1; i <= 12; i++)
            {
                keyboard[(CorsairLedId)System.Enum.Parse(typeof(CorsairLedId), "F" + i)].Color = nothing;
            }

            keyboard[CorsairKeyboardLedId.D0].Color = nothing;
            keyboard[CorsairKeyboardLedId.D1].Color = nothing;
            keyboard[CorsairKeyboardLedId.D2].Color = nothing;
            keyboard[CorsairKeyboardLedId.D3].Color = nothing;
            keyboard[CorsairKeyboardLedId.D4].Color = nothing;
            keyboard[CorsairKeyboardLedId.D5].Color = nothing;
            keyboard[CorsairKeyboardLedId.D6].Color = nothing;
            keyboard[CorsairKeyboardLedId.D7].Color = nothing;
            keyboard[CorsairKeyboardLedId.D8].Color = nothing;
            keyboard[CorsairKeyboardLedId.D9].Color = nothing;

            keyboard[CorsairKeyboardLedId.CommaAndLessThan].Color     = nothing;
            keyboard[CorsairKeyboardLedId.PeriodAndBiggerThan].Color  = nothing;
            keyboard[CorsairKeyboardLedId.SlashAndQuestionMark].Color = nothing;
            keyboard[CorsairKeyboardLedId.SemicolonAndColon].Color    = nothing;
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseKeyGroup"/> class.
        /// </summary>
        /// <param name="keyboard">The keyboard this keygroup belongs to.</param>
        /// <param name="autoAttach">Specifies whether this group should be automatically attached or not.</param>
        protected BaseKeyGroup(CorsairKeyboard keyboard, bool autoAttach = true)
        {
            this.Keyboard = keyboard;

            if (autoAttach)
                this.Attach();
        }
Exemple #5
0
 //Draw points(ps) with color(c) and offset on keyboard(k)
 public static void LEDDrawAt(CorsairKeyboard k, Color c, PointF[] ps, PointF offset)
 {
     foreach (var p in ps)
     {
         LEDDrawAt(k, c, (int)(p.X + offset.X), (int)(p.Y + offset.Y));
     }
 }
Exemple #6
0
 //Draw points(ps) with color(c) on keyboard(k)
 public static void LEDDrawAt(CorsairKeyboard k, Color c, PointF[] ps)
 {
     foreach (var p in ps)
     {
         LEDDrawAt(k, c, (int)p.X, (int)p.Y);
     }
 }
        private void SetupNetwork(string ip)
        {
            _localIp         = ip;
            _sendToAddress   = IPAddress.Parse(ip);
            _sendingEndPoint = new IPEndPoint(_sendToAddress, 56700);

            try
            {
                CueSDK.Initialize();
                if (CueSDK.KeyboardSDK != null)
                {
                    CueSDK.KeyboardSDK.Brush = (SolidColorBrush)System.Drawing.Color.Transparent;
                }
                if (CueSDK.MouseSDK != null)
                {
                    CueSDK.MouseSDK.Brush = (SolidColorBrush)System.Drawing.Color.Transparent;
                }
                Mouse    = CueSDK.MouseSDK;
                Keyboard = CueSDK.KeyboardSDK;
                if (Keyboard != null)
                {
                    KeyboardLedDictionary = Keyboard.Leds.ToDictionary(x => x.Id.ToString(), x => x);
                }
            }
            catch (Exception e) { }

            auraSDK = new AuraSDK();
        }
Exemple #8
0
        public Form1()
        {
            InitializeComponent();
            Initialize();
            keyboard = CueSDK.KeyboardSDK;

            //ambientRect = GenerateAmbientKeyGroup(ambientRect);
        }
Exemple #9
0
        public void Draw(CorsairKeyboard keyboard, Color colorPoints, Color colorLines)
        {
            //Draw points
            DrawPoints(keyboard, colorPoints);

            //Draw lines between them
            DrawLines(keyboard, colorLines);
        }
Exemple #10
0
        //Draw line between pStart and pEnd with color(c) on keyboard(k)
        public static void LEDDrawLineAt(CorsairKeyboard k, Color c, PointF pStart, PointF pEnd)
        {
            int res = 23;

            for (int x = 0; x < res; x++)
            {
                LEDDrawAt(k, c, PointF3D.Lerp(pStart, pEnd, x / (float)res));
            }
        }
Exemple #11
0
 private static void writeSentences(CorsairKeyboard keyboard, List <Message> messages, Color color1, Color color2, int typingTime)
 {
     foreach (Message message in messages)
     {
         Console.WriteLine("Writing Message: " + message.text);
         writeSentence(keyboard, message.text, color1, color2, typingTime);
         Wait(3000);
     }
 }
Exemple #12
0
        private void SyncWithCorsairKeyboard_Click(object sender, RoutedEventArgs e)
        {
            graphicsCard.DisableLights();
            CorsairKeyboard keyboard = CueSDK.KeyboardSDK;

            Debug.WriteLine("Keyboard Found: " + CueSDK.IsSDKAvailable(CorsairDeviceType.Keyboard));
            int r = keyboard['A'].Color.R;

            graphicsCard.SetColor(r, g, b);
        }
 // Define your groups here
 public virtual void Init()
 {
     try
     {
         Keyboard = CueSDK.KeyboardSDK;
         if (Keyboard == null)
         {
             throw new WrapperException("No keyboard found");
         }
         OnInput = (sender, args) =>
         {
             CorsairLedId ledId   = args.LedId;
             bool         pressed = args.Action == InputAction.Pressed;
             //Console.WriteLine("Key pressed: {0}", ledId);
             if (ledId == CorsairLedId.RightCtrl)
             {
                 CtrlDown = pressed;
             }
             else if (ledId == CorsairLedId.RightShift)
             {
                 ShiftDown = pressed;
             }
             else if (ledId == CorsairLedId.RightAlt)
             {
                 AltDown = pressed;
             }
             else if (CtrlDown && AltDown && ledId == CorsairLedId.ScrollLock && pressed)
             {
                 Environment.Exit(0);
             }
             else if (CtrlDown && ShiftDown && ledId == CorsairLedId.ScrollLock && pressed)
             {
                 fadeFromBlack();
             }
             if (!OnKeyPress(ledId, pressed))
             {
                 foreach (KeyManager keyManager in KeyManagers)
                 {
                     if (keyManager.OnKeypress(ledId, pressed))
                     {
                         return;
                     }
                 }
             }
         };
     }
     catch (CUEException ex)
     {
         Debug.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
     }
     catch (WrapperException ex)
     {
         Debug.WriteLine("Wrapper Exception! Message:" + ex.Message);
     }
 }
Exemple #14
0
 public IsaacKeyboard()
 {
     try
     {
         //initialize CueSDK and create a corsair keyboard from it
         CueSDK.Initialize();
         Debug.WriteLine("CueSDK Initialized - " + CueSDK.LoadedArchitecture);
         keyBoard = CueSDK.KeyboardSDK;
     }
     catch (Exception e)
     {
         Debug.WriteLine("Error: " + e);
         isNull = true;
     }
     //register every F key except F12
     for (int i = 1; i < 12; i++)
     {
         HealthKeys[i - 1] = (CorsairKeyboardKeyId)(i + 1);
         Debug.WriteLine("-{0} Added-", HealthKeys[i]);
     }
     //Who made F12 equal to 73??
     HealthKeys[11] = CorsairKeyboardKeyId.F12;
     Debug.WriteLine("-{0} Added-", HealthKeys[11]);
     //register consumable key groups
     if (keyBoard.DeviceInfo.Model == "K95 RGB")
     {
         for (int i = 0; i < 6; i++)
         {
             CoinKeys[i] = (CorsairKeyboardKeyId)(i + 121);
             Debug.WriteLine("-{0} Added-", HealthKeys[i]);
         }
         for (int i = 0; i < 4; i++)
         {
             BombKeys[i] = (CorsairKeyboardKeyId)(i + 127);
             Debug.WriteLine("-{0} Added-", HealthKeys[i]);
         }
         BombKeys[4] = CorsairKeyboardKeyId.G11;
         BombKeys[5] = CorsairKeyboardKeyId.G12;
         for (int i = 0; i < 6; i++)
         {
             KeyKeys[i] = (CorsairKeyboardKeyId)(i + 139);
             Debug.WriteLine("-{0} Added-", HealthKeys[i]);
         }
     }
     else
     {
         ENABLE_G_KEYS = false;
     }
     //I'm keeping this here for future reference
     //keyBoard['A'].Led.Color = Color.Red;
     //keyBoard[CorsairKeyboardKeyId.Home].Led.Color = Color.White;
     //keyBoard.Update();
     //keyBoard.UpdateMode = CUE.NET.Devices.Generic.Enums.UpdateMode.Continuous;
     //keyBoard.UpdateFrequency = 1f / 20f;
 }
        public static void Main(Model model)
        {
            try {
                CueSDK.Initialize();
                System.Console.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");

                CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
                if (keyboard == null)
                {
                    throw new WrapperException("No keyboard found");
                }

                keyboard.Brush = (SolidColorBrush)Color.Transparent;

                model.Translation(new PointF(10, 3)); //Flyt den ind i midten af tastaturet
                model.Translation(new PointF3D(0));   //Flyt modellen
                model.Scaler(4.0f);
                while (true)
                {
                    model.RotateBy(new PointF3D((float)model.properties.rotateAmount, (float)model.properties.rotateAmount, (float)model.properties.rotateAmount));

                    Draw.LEDClear(keyboard);
                    System.Console.Clear();

                    //System.Console.WriteLine("Model points");
                    //foreach (var point in model.GetPoints()) {
                    //    Matrix.Log(point);
                    //}

                    System.Console.WriteLine("Scaler");
                    Matrix.Log(model.GetScaler());

                    System.Console.WriteLine("Translator");
                    Matrix.Log(model.GetTranslater());

                    System.Console.WriteLine("Translator2D");
                    Matrix.Log(model.GetTranslater2D());

                    System.Console.WriteLine("Rotation");
                    Matrix.Log(model.GetRotation());

                    model.Draw(keyboard, Color.Red, Color.Green);
                    keyboard.Update();

                    Thread.Sleep((int)(0.1 * 1000));
                }
            } catch (CUEException ex) {
                System.Console.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
            } catch (WrapperException ex) {
                System.Console.WriteLine("Wrapper Exception! Message:" + ex.Message);
            }

            System.Console.Read();
        }
Exemple #16
0
        public bool Initialize()
        {
            if (!isInitialized)
            {
                try
                {
                    CueSDK.Initialize(true);
                    Global.logger.LogLine("Corsair device, Initialized with " + CueSDK.LoadedArchitecture + "-SDK", Logging_Level.Info);

                    keyboard = CueSDK.KeyboardSDK;
                    mouse    = CueSDK.MouseSDK;
                    headset  = CueSDK.HeadsetSDK;

                    if (keyboard == null && mouse == null && headset == null)
                    {
                        throw new WrapperException("No devices found");
                    }
                    else
                    {
                        if (Global.Configuration.corsair_first_time)
                        {
                            CorsairInstallInstructions instructions = new CorsairInstallInstructions();
                            instructions.ShowDialog();

                            Global.Configuration.corsair_first_time = false;
                            Settings.ConfigManager.Save(Global.Configuration);
                        }

                        SaveLeds();
                        isInitialized = true;
                        return(true);
                    }
                }
                catch (CUEException ex)
                {
                    Global.logger.LogLine("Corsair device, CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error), Logging_Level.Error);
                }
                catch (WrapperException ex)
                {
                    Global.logger.LogLine("Corsair device, Wrapper Exception! Message:" + ex.Message, Logging_Level.Error);
                }
                catch (Exception ex)
                {
                    Global.logger.LogLine("Corsair device, Exception! Message:" + ex, Logging_Level.Error);
                }

                isInitialized = false;
                return(false);
            }

            return(isInitialized);
        }
 //Checks that we have a valid KeyboardSDK instance
 private bool CheckForKeyboard()
 {
     keyboard = CueSDK.KeyboardSDK;
     if (!CheckForCUEError() || Keyboard == null)
     {
         Console.WriteLine("No Corsair keyboard connected!.");
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemple #18
0
        public SnakeGame()
        {
            Keyboard = CueSDK.KeyboardSDK;

            KeyboardLayout = new KeyboardLayout();

            // Allow manual color changes
            Keyboard.Brush = (SolidColorBrush)CorsairColor.Transparent;

            ShowStartScreen();

            SetupThreads();
        }
Exemple #19
0
        public void Draw(CorsairKeyboard keyboard, Color colorPoints, Color colorLines)
        {
            //Tegner rotations midt
            if (properties.displayCenterOfRotation)
            {
                Different_Platforms.CUE.Draw.LEDDrawAt(keyboard, Color.Blue, CalcNewPoint(new PointF3D()));
            }

            //Draw lines
            DrawLines(keyboard, colorLines);

            //Draw with points on them
            DrawPoints(keyboard, colorPoints);
        }
 public void Initialize()
 {
     if (CueSDK.IsSDKAvailable())
     {
         CueSDK.Initialize();
         Console.WriteLine("Initialized Corsair CUE with " + CueSDK.LoadedArchitecture + "-SDK");
         _keyboard         = CueSDK.KeyboardSDK;
         CueSDK.UpdateMode = UpdateMode.Manual;
     }
     else
     {
         Console.WriteLine("Failed to initialize Corsair CUE SDK, is it installed?");
     }
 }
        private void onAnalysis(object sender, List <byte> data)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke((MethodInvoker) delegate() {
                    chart_Spectrum.Series.Clear();
                    Series series    = this.chart_Spectrum.Series.Add("Spectrum");
                    series.ChartType = SeriesChartType.Column;
                    foreach (byte b in data)
                    {
                        series.Points.Add(b);
                    }
                });
            }

            // Set everything to Black
            for (int i = 0; i < CueSDK.KeyboardSDK.Leds.Count(); i++)
            {
                CueSDK.KeyboardSDK.Leds.ElementAt(i).Color = Color.FromArgb(255, 0, 0, 0);
            }

            CorsairKeyboard keyboard = CueSDK.KeyboardSDK;

            for (int i = 0; i < EqualizerKeyMap.GetLength(1); i++)
            {
                byte val = data[i];
                if (val > 30) //Seuil
                {
                    CueSDK.KeyboardSDK[(CorsairLedId)EqualizerKeyMap[0, i]].Color = Color.Red;
                }
                if (val > 75)
                {
                    CueSDK.KeyboardSDK[(CorsairLedId)EqualizerKeyMap[1, i]].Color = Color.Orange;
                }
                if (val > 130)
                {
                    CueSDK.KeyboardSDK[(CorsairLedId)EqualizerKeyMap[2, i]].Color = Color.Blue;
                }
                if (val > 170)
                {
                    CueSDK.KeyboardSDK[(CorsairLedId)EqualizerKeyMap[3, i]].Color = Color.BlueViolet;
                }
                if (val > 215)
                {
                    CueSDK.KeyboardSDK[(CorsairLedId)EqualizerKeyMap[4, i]].Color = Color.Violet;
                }
            }

            CueSDK.KeyboardSDK.Update();
        }
 /// <summary>
 /// <para>This function will try to start the Corsair SDK</para>
 /// <para>This function will use exclusive access!</para>
 /// </summary>
 /// <returns>If false, then the SDK failed the initialize</returns>
 public static bool initSDK()
 {
     try{
         CueSDK.Initialize(true);
         keyboard = CueSDK.KeyboardSDK;
         if (keyboard == null)
         {
             throw new WrapperException("No keyboard found!");
         }
         keyboard.UpdateMode = CUE.NET.Devices.Generic.Enums.UpdateMode.Continuous;                 // No need to call manual update, as we do it automatic
         return(true);
     }catch (Exception) {
         return(false);
     }
 }
Exemple #23
0
        public Corsair(bool runWithoutKeyboard = false)
        {
            this.runWithoutKeyboard = runWithoutKeyboard;
            if (runWithoutKeyboard)
            {
                return;
            }
            if (!CueSDK.IsInitialized)
            {
                CueSDK.Initialize();
            }

            keyboard       = CueSDK.KeyboardSDK;
            keyboard.Brush = (SolidColorBrush)Color.Transparent;
        }
Exemple #24
0
        public static void TeamLighting(int teamValue)
        {
            CorsairKeyboard keyboard = CueSDK.KeyboardSDK;

            if (teamValue == 0)
            {
                SolidColorBrush blueTeam = new SolidColorBrush(Color.Blue);
                blueTeam.Brightness = 0.4F;
                keyboard.Brush      = blueTeam;
            }
            else
            {
                SolidColorBrush orangeTeam = new SolidColorBrush(Color.OrangeRed);
                orangeTeam.Brightness = 0.4F;
                keyboard.Brush        = orangeTeam;
            }
            keyboard.Update();
        }
Exemple #25
0
        public static void Setup()
        {
            keyboard = CueSDK.KeyboardSDK;
            if (keyboard == null)
            {
                IsKeyboardCompatible = false;
                return;
            }

            HealthLedIDs = new List <CorsairLedId>()
            {
                CorsairLedId.D0,
                CorsairLedId.D1,
                CorsairLedId.D2,
                CorsairLedId.D3,
                CorsairLedId.D4,
                CorsairLedId.D5,
                CorsairLedId.D6,
                CorsairLedId.D7,
                CorsairLedId.D8,
                CorsairLedId.D9,
            };
            ManaLedIDs = new List <CorsairLedId>()
            {
                CorsairLedId.F1,
                CorsairLedId.F2,
                CorsairLedId.F3,
                CorsairLedId.F4,
                CorsairLedId.F5,
                CorsairLedId.F6,
                CorsairLedId.F7,
                CorsairLedId.F8,
                CorsairLedId.F9,
                CorsairLedId.F10,
                CorsairLedId.F11,
                CorsairLedId.F12,
            };

            HealthGroup = new ListLedGroup(keyboard, HealthLedIDs);
            ManaGroup   = new ListLedGroup(keyboard, ManaLedIDs);

            keyboard.Brush = (SolidColorBrush)CorsairColor.Transparent;
            keyboard.Update();
        }
        public void Initialize()
        {
            // Initialize everything
            CueSDK.Initialize();

            _keyboard = CueSDK.KeyboardSDK;
            if (_keyboard == null)
            {
                throw new WrapperException("No keyboard found ...");
            }

            // With this you could set the update frequency - the default (30 updates per second) should be fine for the most things
            //_keyboard.UpdateFrequency = 1f / 60f; // 60 updates per second

            // This is useful for debugging-purposes
            _keyboard.Exception += (sender, args) => Console.WriteLine(args.Exception.Message);

            Console.WriteLine("CUE.NET initialized!");
        }
Exemple #27
0
        static void Main(string[] args)
        {
            CueSDK.Initialize();
            CueSDK.UpdateMode      = CUE.NET.Devices.Generic.Enums.UpdateMode.Continuous;
            CueSDK.UpdateFrequency = 1f / 30f;

            CorsairKeyboard keyboard = CueSDK.KeyboardSDK;

            bool done = false;

            List <CorsairLedId> wasd = new List <CorsairLedId>();

            wasd = new List <CorsairLedId>();
            wasd.Add(CorsairLedId.W);
            wasd.Add(CorsairLedId.A);
            wasd.Add(CorsairLedId.S);
            wasd.Add(CorsairLedId.D);

            CorsairColor wasdColor  = new CorsairColor(255, 0, 0);
            CorsairColor mainColor  = new CorsairColor(0, 64, 255);
            CorsairColor otherColor = new CorsairColor(255, 255, 255);

            while (!done)
            {
                currentMultiplier -= 0.05f;
                if (currentMultiplier <= 0.0f)
                {
                    currentMultiplier = 0.0f;
                    done = true;
                }

                foreach (CorsairLedId led in wasd)
                {
                    keyboard[led].Color = new CorsairColor((byte)(currentMultiplier * wasdColor.R), (byte)(currentMultiplier * wasdColor.G), (byte)(currentMultiplier * wasdColor.B));
                }


                System.Threading.Thread.Sleep(64);
            }

            System.Threading.Thread.Sleep(5000);
        }
Exemple #28
0
        void Initialize()
        {
            try
            {
                CueSDK.Initialize();
                //Debug.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");

                CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
                if (keyboard == null)
                {
                    throw new WrapperException("No keyboard found");
                }
            }
            catch (CUEException ex)
            {
                Debug.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
            }
            catch (WrapperException ex)
            {
                Debug.WriteLine("Wrapper Exception! Message:" + ex.Message);
            }
            timer          = new Timer();
            timer.Tick    += new EventHandler(Refresh);
            timer.Interval = 100; // in miliseconds
            timer.Start();
            if (Settings.Default.Start_minimized)
            {
                notifyIcon.Visible = true;
            }
            if (Settings.Default.Enable_with_application_start)
            {
                lightningMode = 0;
                active        = true;
            }
            if (Settings.Default.Display_color)
            {
                currentcolor.Visible = true;
            }
            context.MenuItems.Add(0, new MenuItem("Exit", new System.EventHandler(Close)));
            notifyIcon.ContextMenu = context;
        }
        //Visualizes keyboard from DataProcessor data
        public void UpdateKeyboard()
        {
            //Ensure we have Exclusive access, else throw.
            if (CueSDK.LastError == CorsairError.NoControl)
            {
                throw new ApplicationException("We lost Exclusive Control!");
            }

            DataProcessor.Process();

            //Do whatever and UpdateLeds
            CorsairKeyboard kb = Keyboard;

            kb.Brush = (SolidColorBrush)Color.Black; //Clear keyboard colors

            if (activeMode != null)
            {
                activeMode.UpdateDelegate();
            }

            Keyboard.Update();
        }
        private void initCUESDK()
        {
            try
            {
                CueSDK.Initialize();
                Console.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");

                CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
                if (keyboard == null)
                {
                    throw new WrapperException("No keyboard found");
                }
            }
            catch (CUEException ex)
            {
                Console.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
            }
            catch (WrapperException ex)
            {
                Console.WriteLine("Wrapper Exception! Message:" + ex.Message);
            }
        }
Exemple #31
0
        public MainWindow()
        {
            InitializeComponent();
            try
            {
                CueSDK.Initialize();
                Debug.WriteLine("Initialized with " + CueSDK.LoadedArchitecture + "-SDK");

                CorsairKeyboard keyboard = CueSDK.KeyboardSDK;
                if (keyboard == null)
                {
                    throw new WrapperException("No Keyboard Found");
                }
            }
            catch (CUEException ex)
            {
                Debug.WriteLine("CUE Exception! ErrorCode: " + Enum.GetName(typeof(CorsairError), ex.Error));
            }
            catch (WrapperException ex)
            {
                Debug.WriteLine("Wrapper Exception! Message: " + ex.Message);
            }
        }
Exemple #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleKeyGroup"/> class.
 /// </summary>
 /// <param name="keyboard">The keyboard this keygroup belongs to.</param>
 /// <param name="rectangle">The rectangle of this keygroup.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a key must have with the <see cref="Rectangle" /> to be taken into the keygroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleKeyGroup(CorsairKeyboard keyboard, RectangleF rectangle, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : base(keyboard, autoAttach)
 {
     this.Rectangle = rectangle;
     this.MinOverlayPercentage = minOverlayPercentage;
 }
Exemple #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleKeyGroup"/> class.
 /// </summary>
 /// <param name="keyboard">The keyboard this keygroup belongs to.</param>
 /// <param name="fromPoint">They first point to calculate the rectangle of this keygroup from.</param>
 /// <param name="toPoint">They second point to calculate the rectangle of this keygroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a key must have with the <see cref="Rectangle" /> to be taken into the keygroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleKeyGroup(CorsairKeyboard keyboard, PointF fromPoint, PointF toPoint, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(keyboard, RectangleHelper.CreateRectangleFromPoints(fromPoint, toPoint), minOverlayPercentage, autoAttach)
 { }
Exemple #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleKeyGroup"/> class.
 /// </summary>
 /// <param name="keyboard">The keyboard this keygroup belongs to.</param>
 /// <param name="fromKey">They first key to calculate the rectangle of this keygroup from.</param>
 /// <param name="toKey">They second key to calculate the rectangle of this keygroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a key must have with the <see cref="Rectangle" /> to be taken into the keygroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleKeyGroup(CorsairKeyboard keyboard, CorsairKey fromKey, CorsairKey toKey, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(keyboard, RectangleHelper.CreateRectangleFromRectangles(fromKey.KeyRectangle, toKey.KeyRectangle), minOverlayPercentage, autoAttach)
 { }
Exemple #35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleKeyGroup"/> class.
 /// </summary>
 /// <param name="keyboard">The keyboard this keygroup belongs to.</param>
 /// <param name="fromKey">They ID of the first key to calculate the rectangle of this keygroup from.</param>
 /// <param name="toKey">They ID of the second key to calculate the rectangle of this keygroup from.</param>
 /// <param name="minOverlayPercentage">(optional) The minimal percentage overlay a key must have with the <see cref="Rectangle" /> to be taken into the keygroup. (default: 0.5f)</param>
 /// <param name="autoAttach">(optional) Specifies whether this group should be automatically attached or not. (default: true)</param>
 public RectangleKeyGroup(CorsairKeyboard keyboard, CorsairKeyboardKeyId fromKey, CorsairKeyboardKeyId toKey, float minOverlayPercentage = 0.5f, bool autoAttach = true)
     : this(keyboard, keyboard[fromKey], keyboard[toKey], minOverlayPercentage, autoAttach)
 { }
 public ListKeyGroup(CorsairKeyboard keyboard, bool autoAttach, params CorsairKeyboardKeyId[] keys)
     : base(keyboard, autoAttach)
 {
     AddKey(keys);
 }
 public ListKeyGroup(CorsairKeyboard keyboard, params CorsairKeyboardKeyId[] keys)
     : this(keyboard, true, keys)
 { }
 public ListKeyGroup(CorsairKeyboard keyboard, bool autoAttach = true)
     : base(keyboard, autoAttach)
 { }