feat: add reset hot keys

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

@ -238,14 +238,14 @@
Visibility="Hidden" Visibility="Hidden"
Foreground="Red" /> Foreground="Red" />
<Button Content="恢复默认" <Button Content="恢复默认"
Template="{StaticResource buttonstyle}" Template="{StaticResource buttonstyle}"
Width="80" Width="80"
Grid.Row="5" Grid.Row="5"
Margin="5" Margin="5"
Grid.Column="1" Grid.Column="1"
Command="{Binding ResetHotKeysCmd}"/> Click="ResetHoskeys_Click"/>
</Grid> </Grid>
</GroupBox> </GroupBox>
</StackPanel> </StackPanel>

@ -149,6 +149,33 @@ namespace STranslate.View
HotkeysHelper.ReRegisterHotKey(); HotkeysHelper.ReRegisterHotKey();
HotKeyConflictCheck(); 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() private void HotKeyConflictCheck()
{ {
this.CrossWordHotKeyConflictLabel.Visibility = ViewModel.MainVM.Instance.NHotkeys.CrosswordTranslate.Conflict ? Visibility.Visible : Visibility.Hidden; this.CrossWordHotKeyConflictLabel.Visibility = ViewModel.MainVM.Instance.NHotkeys.CrosswordTranslate.Conflict ? Visibility.Visible : Visibility.Hidden;

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

Loading…
Cancel
Save