예제 #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);
        }
예제 #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();
        }