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

Multiple Icon Overlay Handlers #417

Open
pkk-code opened this issue Jan 14, 2025 · 1 comment
Open

Multiple Icon Overlay Handlers #417

pkk-code opened this issue Jan 14, 2025 · 1 comment

Comments

@pkk-code
Copy link

Version of SharpShell used: 2.7.2.0

I'm trying to display different overlay icons based on certain conditions (example download/upload). Initially, I attempted to implement the switching logic within a single class to toggle between icons, but this approach didn’t work, as mentioned in #373, since only one icon can be mapped per class.

As a result, I revised my implementation to use two separate classes for updating the overlay icon depending on the condition. However, only one handler is triggered at a time. If I unregister the download handler, the upload handler works as expected. But when both handlers are registered, the upload handler is not triggered as frequently as the download handler.

Do you have an example or suggestion for handling multiple overlay icons on same file? This could be helpful for others as well.

From sharpshell log with both handlers are registered:

Line 533942: 2025-01-14 10:19:04.829Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning False

Line 533949: 2025-01-14 10:19:04.885Z - explorer - Upload: IsMemberOf for C:\Dev\random.txt - returning False
Line 546836: 2025-01-14 11:14:56.811Z - explorer - Upload: IsMemberOf for C:\Dev\random.txt - returning False
Line 547160: 2025-01-14 11:15:05.180Z - explorer - Upload: IsMemberOf for C:\Dev\random.txt - returning False
Line 547239: 2025-01-14 11:15:29.607Z - explorer - Upload: IsMemberOf for C:\Dev\random.txt - returning False
Line 547459: 2025-01-14 11:18:21.182Z - explorer - Upload: IsMemberOf for C:\Dev\random.txt - returning False
Line 547781: 2025-01-14 11:33:07.968Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning False
Line 547791: 2025-01-14 11:33:24.308Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning False
Line 548058: 2025-01-14 11:34:25.526Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning False
Line 548365: 2025-01-14 11:34:47.270Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning False
Line 548369: 2025-01-14 11:34:52.663Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 548402: 2025-01-14 11:34:53.604Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 548896: 2025-01-14 11:45:25.109Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 549175: 2025-01-14 11:45:57.589Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 549198: 2025-01-14 11:45:57.808Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning False
Expecting call from Upload handler  - explorer - Upload: but none occurred 
....
.....
Line 549826: 2025-01-14 11:47:28.949Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 549840: 2025-01-14 11:48:21.712Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 549842: 2025-01-14 11:48:31.307Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
Line 549844: 2025-01-14 11:48:32.778Z - explorer - Download: IsMemberOf for C:\Dev\random.txt - returning True
@pkk-code
Copy link
Author

I got it working. The CanShowOverlay function in the handler1 needs to return false, which ensures the next handler is triggered. That's why the handler2 was never called—clever approach.

Thank you for creating this wonderful library.

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

No branches or pull requests

1 participant