public LaunchpadManager() { _launchpad = LaunchpadMk2.GetInstance().Result; _launchpad.Clear(); _launchpad.OnButtonStateChanged += button => { if (_activeProfile == null) { return; } if (button.State == LaunchpadButtonState.Pressed) { if (button.X == 8) { // Profile changing buttons var profileCandidate = _profiles.FirstOrDefault(x => x.LaunchpadCoord.Y == button.Y); if (profileCandidate != null) { SetProfileActive(profileCandidate); } } else { Console.WriteLine($"Button @ {button.X},{button.Y} of profile {_activeProfile.Name} clicked!"); var clickableButton = _activeProfile.Buttons.FirstOrDefault(x => x.X == button.X && x.Y == button.Y); var clickCallback = clickableButton?.ClickCallback; clickCallback?.Invoke(); } } }; }
public void Shutdown() { _launchpad.Clear(); }