示例#1
0
        public override bool Initialize()
        {
            if (isInitialized)
            {
                return(true);
            }

            device_key     = GlobalVarRegistry.GetVariable <DeviceKeys>($"{DeviceName}_devicekey");
            enable_generic = GlobalVarRegistry.GetVariable <bool>($"{DeviceName}_enable_generic");
            enable_ryos    = GlobalVarRegistry.GetVariable <bool>($"{DeviceName}_enable_ryos");

            talkFx     = new TalkFxConnection();
            ryosTalkFx = new RyosTalkFXConnection();

            //Will return true even when no Ryos is connected. Check if TalkFx is opened?
            //Is even requierd for 1 color devices with the used sdk version.
            if (!ryosTalkFx.Initialize())
            {
                LogInfo("Could not initialize Ryos Talk Fx");
                return(isInitialized = false);
            }

            //Will return true even when no Ryos is connected. Check if TalkFx is opened?
            //Is even requierd for 1 color devices with the used sdk version.
            if (!ryosTalkFx.EnterSdkMode())
            {
                LogInfo("Could not Enter Ryos SDK Mode");
                return(isInitialized = false);
            }

            return(isInitialized = true);
        }
示例#2
0
 /// <summary>
 /// Initiate connection to device
 /// </summary>
 public static bool connect()
 {
     if (connection.Initialize())
     {
         return(connection.EnterSdkMode());
     }
     return(false);
 }
示例#3
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");
            }
        }
示例#4
0
        public bool Initialize()
        {
            if (!isInitialized)
            {
                try
                {
                    talkFX     = new TalkFxConnection();
                    RyosTalkFX = new RyosTalkFXConnection();

                    if (RyosTalkFX != null)
                    {
                        RyosInitialized = RyosTalkFX.Initialize();
                        RyosInitialized = RyosInitialized && RyosTalkFX.EnterSdkMode();
                    }

                    if (talkFX == null ||
                        RyosTalkFX == null ||
                        !RyosInitialized
                        )
                    {
                        throw new Exception("No devices connected");
                    }
                    if (Global.Configuration.roccat_first_time)
                    {
                        App.Current.Dispatcher.Invoke(() =>
                        {
                            RoccatInstallInstructions instructions = new RoccatInstallInstructions();
                            instructions.ShowDialog();
                        });
                        Global.Configuration.roccat_first_time = false;
                        Settings.ConfigManager.Save(Global.Configuration);
                    }
                    isInitialized = true;
                    return(true);
                }
                catch (Exception ex)
                {
                    Global.logger.Error("Roccat device, Exception! Message:" + ex);
                }

                isInitialized = false;
                return(false);
            }

            return(isInitialized);
        }
示例#5
0
        public bool InitializeSdk()
        {
            try
            {
                _client = new RyosTalkFXConnection();
                _client.Initialize();
                _client.EnterSdkMode();
                _initialized = true;

                //client.SetLedOn(KeyboardLayout_EN);

                return(true);
            }
            catch (Exception ex)
            {
                Write.WriteConsole(ConsoleTypes.Roccat, @"Roccat SDK failed to load. Error: " + ex.Message);
                return(false);
            }
        }
示例#6
0
        public bool Initialize()
        {
            if (!isInitialized)
            {
                try
                {
                    talkFX     = new TalkFxConnection();
                    RyosTalkFX = new RyosTalkFXConnection();

                    if (RyosTalkFX != null)
                    {
                        RyosInitialized = RyosTalkFX.Initialize();
                        RyosInitialized = RyosInitialized && RyosTalkFX.EnterSdkMode();
                    }


                    if (talkFX == null &&
                        RyosTalkFX == null &&
                        !RyosInitialized
                        )
                    {
                        throw new Exception("No devices connected");
                    }

                    isInitialized = true;
                    return(true);
                }
                catch (Exception ex)
                {
                    Global.logger.LogLine("Roccat device, Exception! Message:" + ex, Logging_Level.Error);
                    System.Windows.Forms.MessageBox.Show("Roccat device, Exception! Message:" + ex);
                }

                isInitialized = false;
                return(false);
            }

            return(isInitialized);
        }
示例#7
0
        public bool Initialize()
        {
            if (!isInitialized)
            {
                try
                {
                    talkFX     = new TalkFxConnection();
                    RyosTalkFX = new RyosTalkFXConnection();

                    if (RyosTalkFX != null)
                    {
                        RyosInitialized = RyosTalkFX.Initialize();
                        RyosInitialized = RyosInitialized && RyosTalkFX.EnterSdkMode();
                    }


                    if (talkFX == null &&
                        RyosTalkFX == null &&
                        !RyosInitialized
                        )
                    {
                        throw new Exception("No devices connected");
                    }

                    isInitialized = true;
                    return(true);
                }
                catch (Exception ex)
                {
                    Global.logger.Error("Roccat device, Exception! Message:" + ex);
                }

                isInitialized = false;
                return(false);
            }

            return(isInitialized);
        }