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

Code Quality: Introduced view models to widgets #14723

Closed
wants to merge 35 commits into from

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented Feb 14, 2024

Summary

  • Introduced view models to widgets
  • Simplify the widget codebase
  • Replaced ICommands with RichCommands
    • EjectDrive
    • FormatDrive
    • Pin
    • Unpin
    • OpenInNewPane
    • OpenInNewTab
    • OpenInNewWindow
    • OpenProperties
    • OpenFileLocation
    • RemoveRecentItem
    • ClearRecentItem
  • 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

  • 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 Code Quality: Refactor Widget controls #13210
  • Did you build the app and test your changes?
  • 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?
  • 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 0x5bfa changed the title Code Quality Code Quality: Introduced view models to widgets Feb 14, 2024
@yaira2
Copy link
Member

yaira2 commented Feb 15, 2024

  • 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?

@0x5bfa
Copy link
Member Author

0x5bfa commented Feb 15, 2024

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 0x5bfa closed this Feb 18, 2024
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

Successfully merging this pull request may close these issues.

Code Quality: Refactor Widget controls
2 participants