Files icon indicating copy to clipboard operation
Files copied to clipboard

Code Quality: Introduced view models to widgets

Open 0x5bfa opened this issue 2 years ago • 2 comments

Summary

  • [x] Introduced view models to widgets
  • [x] Simplify the widget codebase
  • [x] Replaced ICommands with RichCommands
    • [x] EjectDrive
    • [x] FormatDrive
    • [x] Pin
    • [x] Unpin
    • [x] OpenInNewPane
    • [x] OpenInNewTab
    • [x] OpenInNewWindow
    • [ ] OpenProperties
    • [x] OpenFileLocation
    • [x] RemoveRecentItem
    • [x] ClearRecentItem
  • [x] Make Refresh button at work

Details

C#:

  • Moved code behind codes to newly created view models
  • Removed a bunch of event handlers in Home page and let handle events in each widget
  • Removed WidgetsHelper because it's now useless
  • Removed duplicated codes and unified
  • Replace ICommands with IRichCommands

XAML:

  • No UI modifications
  • Moved resources xaml out of HomePage and placed to newly created ResourceDictionary

PR Checklist

  • [x] Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers. Closes #13210
  • [x] Did you build the app and test your changes?
  • [x] Did you check for accessibility? You can use Accessibility Insights for this.
  • [ ] Did you remove any strings from the en-us resource file?
    • [ ] Did you search the solution to see if the string is still being used?
  • [ ] Did you implement any design changes to an existing feature?
    • [ ] Was this change approved?
  • [x] Are there any other steps that were used to validate these changes?
    1. Lanuch the app
    2. See the widgets shown correctly
    3. Right click an item
    4. See the context flyout shown correctly
    5. Add a new tab
    6. See the Home page loaded correctly

Tested locally ✅

0x5bfa avatar Feb 14 '24 15:02 0x5bfa

  • Are the ViewModels shared or does each tab have its own instance?
  • Does this fix the issue where refreshing the home page doesn't update the drives?

yaira2 avatar Feb 15 '24 19:02 yaira2

Are the ViewModels shared or does each tab have its own instance?

@hishitetsu doesn't recommend. Can you clarify why this is need?

Does this fix the issue where refreshing the home page doesn't update the drives?

Yep, fixed.

0x5bfa avatar Feb 15 '24 21:02 0x5bfa