In the following code:
Add-Type -AssemblyName PresentationFramework
$window = New-Object Windows.Window
$commonKeyEvents = {
[System.Windows.Input.KeyEventArgs] $e = $args[1]
if ($e.Key -eq 'ESC') { $this.close() }
if ($e.Key -eq 'Ctrl+Q') { $this.close() }
}
$window.add_PreViewKeyDown($commonKeyEvents)
$window.ShowDialog() | Out-Null
the 'Ctrl+Q' part does not work. How could I make this work?