public async void visualizeButtonPress(LaunchpadButton button, ButtonPressEventArgs e, string name) { string targetName = ""; switch (e.Type) { case ButtonType.Grid: targetName = "_" + name; break; case ButtonType.Side: targetName = "side" + name; break; case ButtonType.Toolbar: targetName = "top" + name; break; } button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); Application.Current.Dispatcher.Invoke(() => { var topBtn = (Button)this.FindName(targetName); topBtn.Background = Brushes.Green; }); await Task.Delay(500); button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); Application.Current.Dispatcher.Invoke(() => { var topBtn = (Button)this.FindName(targetName); topBtn.Background = Brushes.Orange; }); }
private void toggleButton( LaunchpadButton button, ButtonType btype, String name) { string targetName; if (btype == ButtonType.Side) { targetName = "side" + name; } else { targetName = "_" + name; } var toggleOn = false; if (button != null) { if (button.RedBrightness == ButtonBrightness.Full && button.GreenBrightness == ButtonBrightness.Full) { button.SetBrightness(ButtonBrightness.Off, ButtonBrightness.Full); toggleOn = true; } else if (button.RedBrightness == ButtonBrightness.Off && button.GreenBrightness == ButtonBrightness.Full) { button.SetBrightness(ButtonBrightness.Full, ButtonBrightness.Full); } } toggleGui(targetName, toggleOn); }