Code quality

This commit is contained in:
Jack251970 2025-07-02 14:04:02 +08:00
parent 730625c6db
commit 1c8a8d0fc6

View file

@ -217,33 +217,6 @@ internal static class HotKeyMapper
}
}
private static void ChangeRegisteredHotkey(RegisteredHotkeyType registeredType, string newHotkeyStr)
{
var newHotkey = new HotkeyModel(newHotkeyStr);
ChangeRegisteredHotkey(registeredType, newHotkey);
}
private static void ChangeRegisteredHotkey(RegisteredHotkeyType registeredType, HotkeyModel newHotkey)
{
// Find the old registered hotkey data item
var registeredHotkeyData = _settings.RegisteredHotkeys.FirstOrDefault(h => h.RegisteredType == registeredType);
// If it is not found, return
if (registeredHotkeyData == null)
{
return;
}
// Remove the old hotkey
RemoveHotkey(registeredHotkeyData);
// Update the hotkey string
registeredHotkeyData.Hotkey = newHotkey;
// Set the new hotkey
SetHotkey(registeredHotkeyData);
}
#endregion
// TODO: Deprecated
@ -509,6 +482,37 @@ internal static class HotKeyMapper
#endregion
#region Hotkey Changing
private static void ChangeRegisteredHotkey(RegisteredHotkeyType registeredType, string newHotkeyStr)
{
var newHotkey = new HotkeyModel(newHotkeyStr);
ChangeRegisteredHotkey(registeredType, newHotkey);
}
private static void ChangeRegisteredHotkey(RegisteredHotkeyType registeredType, HotkeyModel newHotkey)
{
// Find the old registered hotkey data item
var registeredHotkeyData = _settings.RegisteredHotkeys.FirstOrDefault(h => h.RegisteredType == registeredType);
// If it is not found, return
if (registeredHotkeyData == null)
{
return;
}
// Remove the old hotkey
RemoveHotkey(registeredHotkeyData);
// Update the hotkey string
registeredHotkeyData.Hotkey = newHotkey;
// Set the new hotkey
SetHotkey(registeredHotkeyData);
}
#endregion
#region Commands
private static RelayCommand<CustomPluginHotkey> _customQueryHotkeyCommand;