feat: add reset hot keys

main
DESKTOP-3BO4HSG\ksat 2 years ago
parent 471cc632b2
commit b561f44678

@ -245,7 +245,7 @@
Grid.Row="5"
Margin="5"
Grid.Column="1"
Command="{Binding ResetHotKeysCmd}"/>
Click="ResetHoskeys_Click"/>
</Grid>
</GroupBox>
</StackPanel>

@ -149,6 +149,33 @@ namespace STranslate.View
HotkeysHelper.ReRegisterHotKey();
HotKeyConflictCheck();
}
private void ResetHoskeys_Click(object sender, RoutedEventArgs e)
{
CrossWordTextBox.Text = "Alt + D";
InputTextBox.Text = "Alt + A";
ScreenshotTextBox.Text = "Alt + S";
ShowMainwinTextBox.Text = "Alt + G";
ViewModel.MainVM.Instance.NHotkeys.CrosswordTranslate.Modifiers = 1;
ViewModel.MainVM.Instance.NHotkeys.CrosswordTranslate.Key = 68;
ViewModel.MainVM.Instance.NHotkeys.CrosswordTranslate.Text = "Alt + D";
ViewModel.MainVM.Instance.NHotkeys.InputTranslate.Modifiers = 1;
ViewModel.MainVM.Instance.NHotkeys.InputTranslate.Key = 65;
ViewModel.MainVM.Instance.NHotkeys.InputTranslate.Text = "Alt + A";
ViewModel.MainVM.Instance.NHotkeys.ScreenShotTranslate.Modifiers = 1;
ViewModel.MainVM.Instance.NHotkeys.ScreenShotTranslate.Key = 83;
ViewModel.MainVM.Instance.NHotkeys.ScreenShotTranslate.Text = "Alt + S";
ViewModel.MainVM.Instance.NHotkeys.OpenMainWindow.Modifiers = 1;
ViewModel.MainVM.Instance.NHotkeys.OpenMainWindow.Key = 71;
ViewModel.MainVM.Instance.NHotkeys.OpenMainWindow.Text = "Alt + G";
HotkeysHelper.ReRegisterHotKey();
HotKeyConflictCheck();
}
private void HotKeyConflictCheck()
{
this.CrossWordHotKeyConflictLabel.Visibility = ViewModel.MainVM.Instance.NHotkeys.CrosswordTranslate.Conflict ? Visibility.Visible : Visibility.Hidden;

@ -72,12 +72,6 @@ namespace STranslate.ViewModel
(o as Window)?.Close();
});
//重置热键
ResetHotKeysCmd = new RelayCommand((_) => true, (_) =>
{
System.Diagnostics.Debug.Print("重置快捷键");
});
OpenUrlCmd = new RelayCommand((_) => true, (o) =>
{
try
@ -114,7 +108,6 @@ namespace STranslate.ViewModel
public ICommand UpdateCmd { get; private set; }
public ICommand StartupCmd { get; private set; }
public ICommand EscCmd { get; private set; }
public ICommand ResetHotKeysCmd { get; private set; }
private static SettingsVM _instance;

Loading…
Cancel
Save