public MainWindow() { try { device = new LaunchpadDevice(); keyboard = new InputSimulator().Keyboard; data = DataStore.Instance; device.DoubleBuffered = true; device.DoubleBuffered = false; Application.Current.Exit += ClearLaunchpad; device.ButtonPressed += HandleLaunchPadInput; InitializeComponent(); InitData(); RefreshPad(); } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (result == MessageBoxResult.OK) { Application.Current.Shutdown(); } } }
public KeyBindingWindow(Shortcut cut, string btnName, bool top) { data = DataStore.Instance; isTop = top; name = btnName; InitializeComponent(); if (isTop) { toggleBox.IsChecked = false; toggleBox.Visibility = Visibility.Hidden; } isToggled = false; groupBox.SelectedIndex = 0; groupBox.Visibility = Visibility.Hidden; groupLabel.Visibility = Visibility.Hidden; group = groupBox.SelectedIndex; if (cut != null) { existingShortcut = cut; tempShortcut = cut; string textBoxVal = ""; if (cut.hasMods) { textBoxVal = cut.Mods.Aggregate(textBoxVal, (current, mod) => current + (mod + " + ")); } textBoxVal += cut.AssignedKey; keyboardInput.Text = textBoxVal; isToggled = cut.isToggle; toggleBox.IsChecked = isToggled; } }
public KeyBindingWindow(Shortcut cut, int xG, int yG) { data = DataStore.Instance; x = xG; y = yG; name = y.ToString() + x; isGrid = true; InitializeComponent(); isToggled = false; if (cut != null) { existingShortcut = cut; tempShortcut = cut; string textBoxVal = ""; if (cut.hasMods) { textBoxVal = cut.Mods.Aggregate(textBoxVal, (current, mod) => current + (mod + " + ")); } textBoxVal += cut.AssignedKey; keyboardInput.Text = textBoxVal; groupBox.SelectedIndex = cut.belongsToGroup; group = cut.belongsToGroup; isToggled = cut.isToggle; toggleBox.IsChecked = isToggled; } }