/// <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); }
/*/// <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(); }
/// <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(); }
/// <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); }