// Assign or unassign the `listeningEditor` from this UserControl private void AssignButton_Click(object sender, RoutedEventArgs e) { var assigning = listeningEditor != this; listeningEditor?.UpdateButtonText(false); UpdateButtonText(assigning); listeningEditor = assigning ? this : null; }
private static void InputEvents_KeyDown(object sender, SharpDX.RawInput.KeyboardInputEventArgs e) { if (listeningEditor != null) { listeningEditor.Dispatcher.Invoke(() => { listeningEditor.SelectedKey = e.Key; listeningEditor.UpdateButtonText(false); listeningEditor = null; }); } }