ShiinaRinne 2 years ago
parent a01b934fdb
commit 25776a788e

@ -72,7 +72,8 @@
VerticalAlignment="Top" VerticalAlignment="Top"
AcceptsReturn="True" AcceptsReturn="True"
IsReadOnly="True" IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" /> Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock <TextBlock
Grid.Row="2" Grid.Row="2"
@ -89,7 +90,8 @@
VerticalAlignment="Top" VerticalAlignment="Top"
AcceptsReturn="True" AcceptsReturn="True"
IsReadOnly="True" IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" /> Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
@ -106,7 +108,8 @@
VerticalAlignment="Top" VerticalAlignment="Top"
AcceptsReturn="True" AcceptsReturn="True"
IsReadOnly="True" IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" /> Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
Grid.Column="0" Grid.Column="0"
@ -122,7 +125,8 @@
VerticalAlignment="Top" VerticalAlignment="Top"
AcceptsReturn="True" AcceptsReturn="True"
IsReadOnly="True" IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" /> Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
<TextBlock <TextBlock
Grid.Row="5" Grid.Row="5"
Grid.Column="0" Grid.Column="0"
@ -138,7 +142,8 @@
VerticalAlignment="Top" VerticalAlignment="Top"
AcceptsReturn="True" AcceptsReturn="True"
IsReadOnly="True" IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" /> Style="{StaticResource MyOutlinedTextBox}"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown" />
</Grid> </Grid>
<TextBlock <TextBlock

@ -20,11 +20,11 @@ namespace v2rayN.Views
_config = LazyConfig.Instance.GetConfig(); _config = LazyConfig.Instance.GetConfig();
_config.globalHotkeys ??= new List<KeyEventItem>(); _config.globalHotkeys ??= new List<KeyEventItem>();
txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_KeyDown; txtGlobalHotkey0.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey1.KeyDown += TxtGlobalHotkey_KeyDown; txtGlobalHotkey1.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey2.KeyDown += TxtGlobalHotkey_KeyDown; txtGlobalHotkey2.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey3.KeyDown += TxtGlobalHotkey_KeyDown; txtGlobalHotkey3.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown; txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_PreviewKeyDown;
HotkeyHandler.Instance.IsPause = true; HotkeyHandler.Instance.IsPause = true;
this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false; this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false;
@ -45,7 +45,7 @@ namespace v2rayN.Views
BindingData(); BindingData();
} }
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e) private void TxtGlobalHotkey_PreviewKeyDown(object sender, KeyEventArgs e)
{ {
e.Handled = true; e.Handled = true;
var _ModifierKeys = new Key[] { Key.LeftCtrl, Key.RightCtrl, Key.LeftShift, var _ModifierKeys = new Key[] { Key.LeftCtrl, Key.RightCtrl, Key.LeftShift,

Loading…
Cancel
Save