Ejemplo n.º 1
0
        /// <summary>
        /// Briefly tests the lighting and returns it to the previously active module after a few seconds
        /// </summary>
        public void DoLightingTest()
        {
            // TODO: Broken, doesn't return to previous module

            if (CurrentLEDModule is BlinkWhiteModule)
            {
                return;
            }

            Task.Run(async() =>
            {
                Debug.WriteLine("Testing lights");
                ProcessListenerService.Stop();
                await Task.Delay(100);
                LEDModule lastActiveModule = CurrentLEDModule;
                LEDModule blinkModule      = BlinkWhiteModule.Create();
                blinkModule.NewFrameReady += UpdateLEDDisplay;
                CurrentLEDModule           = blinkModule;
                await Task.Delay(5000);
                ProcessListenerService.Start();
                if (CurrentLEDModule is BlinkWhiteModule)
                {
                    CurrentLEDModule = lastActiveModule;
                }
            }).ContinueWith((t) => Debug.WriteLine(t.Exception.Message + " // " + t.Exception.StackTrace), TaskContinuationOptions.OnlyOnFaulted);
        }
Ejemplo n.º 2
0
        /*/// <summary>
         * /// Sets the light controller to be used
         * /// </summary>
         * public void SetController(LightControllerType type, int ledCount = 0, bool reverseOrder = false)
         * {
         *  ((IDisposable)lightController).Dispose();
         *  if (type == LightControllerType.LED_Strip)
         *  {
         *      lightController = SACNController.Create();
         *      this.preferredMode = LightingMode.Line;
         *  }
         *  else if (type == LightControllerType.RazerChroma)
         *  {
         *      lightController = RazerChromaController.Create();
         *      this.preferredMode = LightingMode.Keyboard;
         *  }
         *  RestartManager(this.preferredMode, ledCount, reverseOrder);
         * }*/

        private void RestartManager() // TODO: Keep game state (i.e. league of legends cooldowns etc)
        {
            UninitLeds();
            CurrentLEDModule = null; // restart the whole service (force module reload)
            ProcessListenerService.Stop();
            InitLeds(reverseOrder);
            ProcessListenerService.Start();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Starts the LED Manager in keyboard mode by default. Use <seealso cref="SetController"/> to further customize settings, especially for LED strips
        /// </summary>
        public LedManager() // by default starts in keyboard mode
        {
            InitLeds();

            ProcessListenerService.ProcessInFocusChanged += OnProcessChanged;
            ProcessListenerService.Start();
            ProcessListenerService.Register("League of Legends"); // Listen when league of legends is opened
            ProcessListenerService.Register("RocketLeague");

            UpdateLEDDisplay(LEDFrame.CreateEmpty(this));
            Task.Run(UpdateLoop).CatchExceptions();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Starts the LED Manager in keyboard mode by default. Use <seealso cref="SetController"/> to further customize settings, especially for LED strips
        /// </summary>
        public LedManager() // by default starts in keyboard mode
        {
            lightController = RazerChromaController.Create();

            InitLeds(LightingMode.Keyboard);

            KeyboardHookService.Init();

            ProcessListenerService.ProcessInFocusChanged += OnProcessChanged;
            ProcessListenerService.Start();
            ProcessListenerService.Register("League of Legends"); // Listen when league of legends is opened

            UpdateLEDDisplay(this, this.leds, preferredMode);
        }
Ejemplo n.º 5
0
 private void RestartManager()
 {
     InitLeds(this.preferredMode, this.ledCount, this.reverseOrder);
     CurrentLEDModule = null;
     ProcessListenerService.Restart();
 }
Ejemplo n.º 6
0
 private void RestartManager(LightingMode preferredMode, int ledCount, bool reverseOrder) // TODO: Keep game state (i.e. league of legends cooldowns etc)
 {
     InitLeds(this.preferredMode, ledCount, reverseOrder);
     CurrentLEDModule = null; // restart the whole service (force module reload)
     ProcessListenerService.Restart();
 }