[Settings] ImageResizer settings accessibility updates, fixes and refactor #36903
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
PR Checklist
Detailed Description of the Pull Request / Additional comments
Accessibility Updates
Preset Descriptions fix
ImageResizerFitToStringConverter
andImageResizerUnitToStringConverter
to create lookups instead of querying for the resource on every call.Localization
ViewModel Fixes and Refactor
SavesImageSizes()
saved the settings to the "sizes.json" file before updating the settings value itself. This may have resulted in issues where adding a new preset, not changing any of its properties, then closing/navigating away would not save the new item in "sizes.json", even though it would be correctly saved in "settings.json".Settings.Properties.ImageresizerCustomSize
instead.EncoderGuid
lookup added, replacing repeated if-else code inGetEncoderGuid()
andGetEncoderIndex()
.Sizes
property and its backing field or temporary variables have been removed and replaced with a centralisedCollectionChanged
handler. For example,SizePropertyChanged
was:and can now be reduced to:
Sizes
observable collection backing field to_sizes
from_advancedSizes
.SetProperty()
function.Encoder
setter. The encoder guid is not saved in that file. It is still saved in "settings.json" inSetProperty()
.AddRow()
to more descriptiveAddImageSize()
. This also matches the existingDeleteImageSize()
.PropertyChanged
event handler not being cleaned up when deleting a size preset, inDeleteImageSize()
. Subscribing and unsubscribing is now handled in new methodsSubscribeToItemPropertyChanged()
andUnsubscribeFromPropertyChanged()
, keeping this related code together.GenerateNameForNewSize()
.ImageSize Fixes and Refactor
Update()
is not required and has been removed. Dependency properties are correctly defined for the bound fields already.SetProperty()
function.ExtraBoxOpacity
field.EnableEtraBoxes
(sic) toIsHeightUsed
, better reflecting its usage.Validation Steps Performed
AIW Tests
Confirmed new accessibility values were present by using Accessibility Insights for Windows:
Other Tests
Tested that: