/// <summary> /// Stops the timer and gives it 1 second to complete. Also stop the screengrabber if no other ambilight effects are active /// </summary> public async Task Deactivate() { _timer.Stop(); Thread.Sleep(1000); //Give the last command the time to complete, 1000 is based on testing and a high value (better safe then sorry) //Check if any other screen mirror effects are active, if not, stop the screen grabber if (OrchestratorCollection.CountOrchestratorsWithActiveScreenMirrorEffect() <= 0) { ScreenGrabber.Stop(); } }