Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorFilter #66

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

stephengillie
Copy link
Collaborator


This isn't complete, due to excessive PR approval volume, but the Get method is at least functional.

@stephengillie stephengillie marked this pull request as ready for review October 10, 2024 18:15
@ryfu-msft
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Comment on lines +612 to +613
$colorFilterSetting = (Get-ItemProperty @FilterStatusArgs).Active
return ($colorFilterSetting -eq ([ColorFilter]::AccessibilityStatusValue))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You get the property value for "Active" which is either 0 or 1, but you compare it with a string "colorfiltering".

$FilterColorArgs = @{ Path = $global:ColorFilteringRegistryPath; Name = ([ColorFilter]::FilterColorProperty)}
if (-not(DoesRegistryKeyPropertyExist @FilterColorArgs))
{
return $false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you be returning the enum value of the default filter rather than $false?


if ($null -ne $this.HotkeyEnabled)
{
$KeyboardShortcutStatusArgs = @{ Path = $global:ColorFilteringRegistryPath; Name = ([ColorFilter]::HotkeyEnabledProperty); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that in this scenario, creating a variable that you use once make it less readable. It makes sense in the Get() method above because you are reusing to check the existence of the key. But here it makes it more confusing and adds 2 unnecessary lines.

Set-ItemProperty -Path $global:ColorFilteringRegistryPath -Name [ColorFilter]::HotkeyEnabledProperty -Value $ColorFilterValue

Please fix this and the other areas that do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants