Пример #1
0
        public bool UpdateDevice(Dictionary <DeviceKeys, System.Drawing.Color> keyColors, bool forced = false)
        {
            if (RyosTalkFX == null || !RyosInitialized) //Not initialzied
            {
                return(false);
            }

            try
            {
                foreach (KeyValuePair <DeviceKeys, System.Drawing.Color> key in keyColors)
                {
                    Roccat_Talk.RyosTalkFX.Key roc_key = ToRoccatKey(key.Key);

                    if (roc_key.Code != 255)
                    {
                        if (Utils.ColorUtils.IsColorDark(key.Value))
                        {
                            RyosTalkFX.SetLedOff(roc_key);
                        }
                        else
                        {
                            RyosTalkFX.SetLedOn(roc_key);
                        }
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                Global.logger.LogLine("Roccat device, error when updating device. Error: " + e, Logging_Level.Error);
                return(false);
            }
        }
Пример #2
0
        private static void RyosTest()
        {
            WriteAndWaitForEnter("RyosTalkFX test, press enter to begin");

            using (var connection = new RyosTalkFXConnection())
            {
                if (connection.Initialize())
                {
                    Console.WriteLine("RyosTalkFX connection initialized...");
                }
                else
                {
                    WriteAndWaitForEnter("RyosTalkFX connection could not be initialized, is the keyboard properly connected? Press enter to exit");
                    return;
                }

                if (connection.EnterSdkMode())
                {
                    Console.WriteLine("Gained control over the keyboard...");
                }
                else
                {
                    WriteAndWaitForEnter("Could not gain control over the keyboard, is another program using it? Press enter to exit");
                    return;
                }

                connection.TurnOffAllLights();
                WriteAndWaitForEnter("All keys should now be OFF, press enter to continue");

                connection.SetLedOn(KeyboardLayout_EN.A);
                WriteAndWaitForEnter("The 'A' key should now be ON, press enter to continue");

                var keyboardState = new KeyboardState();
                keyboardState.AllLedsOn();
                connection.SetWholeKeyboardState(keyboardState);
                WriteAndWaitForEnter("All keys should now be ON, press enter to continue");

                connection.SetLedOff(KeyboardLayout_EN.B);
                WriteAndWaitForEnter("The 'B' key should be OFF, press enter to continue");

                connection.BlinkAllKeys(1, 10);
                WriteAndWaitForEnter("All keys should now be blinking, press enter to continue");

                if (connection.ExitSdkMode())
                {
                    Console.WriteLine("Released control of the keyboard...");
                }
                else
                {
                    Console.WriteLine("Could not release control of the keyboard!");
                }

                WriteAndWaitForEnter("RyosTalkFX test now finished, press enter to continue");
            }
        }