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
Code Quality: Use view models in Widgets #14926
base: main
Are you sure you want to change the base?
Conversation
f312f0e
to
70e2ff6
Compare
b503cd7
to
af1f1f4
Compare
af1f1f4
to
ecb3cea
Compare
src/Files.App/ViewModels/UserControls/Widgets/DrivesWidgetViewModel.cs
Outdated
Show resolved
Hide resolved
Code wise it looks good (hopefully @d2dyno1 can look it over as well since he did a lot of the original work on this) but I want to test it before merging. Which steps were taken to validate these changes? |
Added steps to the body! |
Can you confirm if disabling a widget will no longer construct that view model? |
There seems to be a performance regression. In the |
32de19b
to
ba56951
Compare
I'll look into that, thanks for the heads up. |
This issue has been fixed by using DI for each widget view model, and this introduces some performance improvements since the app uses the same instance and event invokers among tabs within the same instance, while previous approach was using static observable item collections for each, which had caused a bit complicated codebase quality. Ready for Review! |
@hishitetsu When you got some time, would you mind if I ask you to review this PR? |
No, I'll take a look when I have time. |
I've found following issues:
|
Not for me. Also, Send To should be in the overflow so duplicated one which was in the primary flyout menu has been removed.
What do you mean by "become that of files"?
Fixed, thanks! |
In `WidgetFileTagsContainerItem.cs`, updated `AsyncRelayCommand` constructors for `ViewMoreCommand` and `OpenAllCommand` to not require `CancellationToken` parameter. Also, updated related methods and simplified `SelectedTagChanged` event invocation. In `FileTagsWidget.xaml`, removed alignment properties from `Grid` element and added new `Setter` for `HorizontalAlignment` in `GridViewItem` style. Renamed `x:Name` property of `ListView` in `RecentFilesWidget.xaml` and updated event handlers accordingly. Also, renamed methods in `RecentFilesWidget.xaml.cs` to reflect this change. In `RecentItem.cs`, changed `Path` property to an override. Lastly, removed `SendTo` menu item from context menu in `FileTagsWidgetViewModel.cs` and `RecentFilesWidgetViewModel.cs`.
Open with and send to should be in the main menu. |
I agree upon "Open With", but "Send To" is a shell menu. |
I'm just pointing out what is different from the current release version. I don't think we should change anything in the UI with this PR. |
Moved `ListedTagViewModel` and `TagViewModel` classes to `Files.App.Data.Models` namespace. Added workaround for file tags `isFolder` in `BaseWidgetViewModel.cs` and updated `GetItemMenuItems` method call to include a new parameter. Enhanced `ListedTagViewModel` and `TagViewModel` classes with new properties and initialized them in constructors. Decorated `TagViewModel` properties with `JsonPropertyName` attributes for JSON representation.
… into 5bfa/Update-WidgetVMs
You are right, sorry, I will fix it anyways. |
Done. |
Summary
Stage1 and stage2. I had to do stage2 in this PR.
PR Checklist
Related Code Quality: Introduce view models to widget controls #14760
Screenshots
None