Skip to content

Refactor application structure and improve performance by optimizing#304

Merged
shibayan merged 3 commits intomasterfrom
optimize
Mar 6, 2026
Merged

Refactor application structure and improve performance by optimizing#304
shibayan merged 3 commits intomasterfrom
optimize

Conversation

@shibayan
Copy link
Copy Markdown
Member

@shibayan shibayan commented Mar 6, 2026

No description provided.

@shibayan shibayan requested a review from Copilot March 6, 2026 06:09
@shibayan shibayan self-assigned this Mar 6, 2026
@shibayan shibayan added the enhancement New feature or request label Mar 6, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR focuses on reducing UI-thread work and repeated allocations in WinQuickLook by moving expensive operations off the hot path and reusing providers.

Changes:

  • Ensure COM objects are always released when iterating shell windows, and stop searching once the foreground Explorer window is found.
  • Avoid repeated sorting/enumeration by sorting preview handlers once at MainWindow construction and deferring association recommendations until the user opens the menu.
  • Move directory entry counting off the UI thread and replace converter-based counting with an async-loaded bindable value; reuse thumbnail/property providers in the audio preview.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
WinQuickLook.Core/Providers/ShellExplorerProvider.cs Adds try/finally COM release and early continue/break logic while scanning shell windows.
WinQuickLook.Core/Providers/ShellAssociationProvider.cs Removes alphabetical sorting of recommended association entries.
WinQuickLook.Core/Extensions/PreviewHandlerExtensions.cs Removes per-call ordering; now iterates handlers as provided.
WinQuickLook.Core/Controls/GenericDirectoryControl.xaml.cs Adds async directory item counting and exposes EntryCount for binding.
WinQuickLook.Core/Controls/GenericDirectoryControl.xaml Switches from count converter to EntryCount binding; removes unused resource entry.
WinQuickLook.Core/Controls/AudioFileControl.xaml.cs Reuses static shell providers and introduces a Thumbnail ref for binding.
WinQuickLook.Core/Controls/AudioFileControl.xaml Binds thumbnail directly (removes converter/resource dictionary usage).
WinQuickLook.App/MainWindow.xaml.cs Sorts handlers once; defers association recommendations; reuses monitor info for sizing/centering.
WinQuickLook.App/MainWindow.xaml Updates associate-button visibility binding to use FileInfo rather than Recommends.
WinQuickLook.App/App.xaml.cs Injects and reuses ShellExplorerProvider instead of creating it per preview action.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread WinQuickLook.App/MainWindow.xaml.cs Outdated
Comment thread WinQuickLook.Core/Controls/GenericDirectoryControl.xaml.cs
Comment thread WinQuickLook.Core/Controls/GenericDirectoryControl.xaml
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

@shibayan I've opened a new pull request, #305, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

@shibayan I've opened a new pull request, #306, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 6, 2026 15:27
* Initial plan

* Add CancellationToken support to GenericDirectoryControl to prevent concurrent directory enumerations

Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com>
…#306)

* Initial plan

* Fix OpenAssociateMenu to cache empty recommends results using null sentinel

Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com>
@shibayan shibayan merged commit dbef2dd into master Mar 6, 2026
4 checks passed
@shibayan shibayan deleted the optimize branch March 6, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants