mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 05:43:10 -07:00
Refactor KeyboardShortcutManager.cs for improved readability and maintainability
The code changes in this commit simplify the logic in the `OnAcceleratorKeyActivated` method of `KeyboardShortcutManager.cs`. - Replaced nested if-else statements with concise conditional expressions - Removed redundant checks for `altPressed` and `controlKeyPressed` - Consolidated return statements based on key combinations
This commit is contained in:
parent
b5e8b207f7
commit
2074db6f78
1 changed files with 7 additions and 38 deletions
|
@ -747,48 +747,17 @@ namespace CalculatorApp
|
||||||
{
|
{
|
||||||
int viewId = Utilities.GetWindowId();
|
int viewId = Utilities.GetWindowId();
|
||||||
|
|
||||||
if (controlKeyPressed)
|
if (controlKeyPressed && !altPressed)
|
||||||
{
|
{
|
||||||
if (altPressed)
|
return shiftKeyPressed ? s_VirtualKeyControlShiftChordsForButtons[viewId] : s_VirtualKeyControlChordsForButtons[viewId];
|
||||||
{
|
}
|
||||||
return null;
|
else if (altPressed && !controlKeyPressed)
|
||||||
}
|
{
|
||||||
else
|
return shiftKeyPressed ? null : s_VirtualKeyAltChordsForButtons[viewId];
|
||||||
{
|
|
||||||
if (shiftKeyPressed)
|
|
||||||
{
|
|
||||||
return s_VirtualKeyControlShiftChordsForButtons[viewId];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return s_VirtualKeyControlChordsForButtons[viewId];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (altPressed)
|
return shiftKeyPressed ? s_VirtualKeyShiftChordsForButtons[viewId] : s_virtualKey[viewId];
|
||||||
{
|
|
||||||
if (shiftKeyPressed)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return s_VirtualKeyAltChordsForButtons[viewId];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (shiftKeyPressed)
|
|
||||||
{
|
|
||||||
return s_VirtualKeyShiftChordsForButtons[viewId];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return s_virtualKey[viewId];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue