[PR #26] [MERGED] Move design to MVVM #62

Closed
opened 2026-01-30 21:23:14 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/aaru-dps/RedBookPlayer/pull/26
Author: @mnadareski
Created: 7/5/2021
Status: Merged
Merged: 7/24/2021
Merged by: @claunia

Base: develHead: mvvm


📝 Commits (10+)

  • be2c704 Make SoundOutput have events
  • cd3ccbc Make OpticalDisc have events
  • 65ab29f Remove need for UI timer for updates
  • 59bfd40 Move all image logic to factory
  • a5bffa8 Make view-model safer
  • 2476d07 Move methods to better locations
  • 8c9f10d Consolidate view init code
  • d863559 View-model and model shouldn't know about settings
  • c43317f Fix minor playback issues
  • 761afb9 Remove needless method calls

📊 Changes

39 files changed (+1795 additions, -984 deletions)

View changed files

📝 .gitmodules (+2 -1)
📝 RedBookPlayer.GUI/App.xaml (+0 -0)
📝 RedBookPlayer.GUI/App.xaml.cs (+1 -0)
📝 RedBookPlayer.GUI/Assets/-.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/0.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/1.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/2.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/3.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/4.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/5.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/6.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/7.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/8.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/9.png (+0 -0)
📝 RedBookPlayer.GUI/Assets/colon.png (+0 -0)
📝 RedBookPlayer.GUI/Program.cs (+1 -1)
📝 RedBookPlayer.GUI/RedBookPlayer.GUI.csproj (+2 -10)
📝 RedBookPlayer.GUI/Settings.cs (+9 -4)
RedBookPlayer.GUI/ViewModels/PlayerViewModel.cs (+672 -0)
📝 RedBookPlayer.GUI/Views/MainWindow.xaml (+1 -1)

...and 19 more files

📄 Description

This PR has the overall goal of moving to an MVVM pattern (fixes #22).

As a part of this, the following changes are implemented:

  • Removed all references to Settings object in anything but UI code
  • Removed all knowledge of the UI from the view-model and model code
  • Added subscriber events for model and view-model code
  • Removed UI timer for forcing updates
  • Provided more methods to safely set values going down the chain
  • Separated out the GUI and common code into separate libraries for future use

Notably, on my development machine, this decreased CPU usage by a fair bit, especially at idle.

As a bonus, since it came up during the refactoring and testing, hidden tracks can now play properly and are controlled by an internal flag set by the settings with the current UI (fixes #10). This ended up being a pretty major thing to address as part of this PR, because a lot of the behavior that was causing hidden tracks to render incorrectly was tied to a poor implementation of track loading and switching.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/aaru-dps/RedBookPlayer/pull/26 **Author:** [@mnadareski](https://github.com/mnadareski) **Created:** 7/5/2021 **Status:** ✅ Merged **Merged:** 7/24/2021 **Merged by:** [@claunia](https://github.com/claunia) **Base:** `devel` ← **Head:** `mvvm` --- ### 📝 Commits (10+) - [`be2c704`](https://github.com/aaru-dps/RedBookPlayer/commit/be2c704654a043218fbeb7959abf101a0ab8f61a) Make SoundOutput have events - [`cd3ccbc`](https://github.com/aaru-dps/RedBookPlayer/commit/cd3ccbc8ebdfee66777d759b6be8bb186bae30a8) Make OpticalDisc have events - [`65ab29f`](https://github.com/aaru-dps/RedBookPlayer/commit/65ab29f29f64ec5280cf8d237f99a427857f878b) Remove need for UI timer for updates - [`59bfd40`](https://github.com/aaru-dps/RedBookPlayer/commit/59bfd405a606072f65f33eb5fc727f945b5e58af) Move all image logic to factory - [`a5bffa8`](https://github.com/aaru-dps/RedBookPlayer/commit/a5bffa83beb747f61c65292e9764267f03ba64dc) Make view-model safer - [`2476d07`](https://github.com/aaru-dps/RedBookPlayer/commit/2476d07619b3dc32a1f051a79f0a84241ab072ef) Move methods to better locations - [`8c9f10d`](https://github.com/aaru-dps/RedBookPlayer/commit/8c9f10dd8ee622e0ad19a5f747b3101f0cef7f75) Consolidate view init code - [`d863559`](https://github.com/aaru-dps/RedBookPlayer/commit/d8635594ec8b8b0a427f32757a3150a40816b1c7) View-model and model shouldn't know about settings - [`c43317f`](https://github.com/aaru-dps/RedBookPlayer/commit/c43317f0017d96e6da860df84489ff99f87d871f) Fix minor playback issues - [`761afb9`](https://github.com/aaru-dps/RedBookPlayer/commit/761afb9344590c6209ac44c7e7ad5258975c4214) Remove needless method calls ### 📊 Changes **39 files changed** (+1795 additions, -984 deletions) <details> <summary>View changed files</summary> 📝 `.gitmodules` (+2 -1) 📝 `RedBookPlayer.GUI/App.xaml` (+0 -0) 📝 `RedBookPlayer.GUI/App.xaml.cs` (+1 -0) 📝 `RedBookPlayer.GUI/Assets/-.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/0.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/1.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/2.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/3.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/4.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/5.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/6.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/7.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/8.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/9.png` (+0 -0) 📝 `RedBookPlayer.GUI/Assets/colon.png` (+0 -0) 📝 `RedBookPlayer.GUI/Program.cs` (+1 -1) 📝 `RedBookPlayer.GUI/RedBookPlayer.GUI.csproj` (+2 -10) 📝 `RedBookPlayer.GUI/Settings.cs` (+9 -4) ➕ `RedBookPlayer.GUI/ViewModels/PlayerViewModel.cs` (+672 -0) 📝 `RedBookPlayer.GUI/Views/MainWindow.xaml` (+1 -1) _...and 19 more files_ </details> ### 📄 Description This PR has the overall goal of moving to an MVVM pattern (fixes #22). As a part of this, the following changes are implemented: - Removed all references to Settings object in anything but UI code - Removed all knowledge of the UI from the view-model and model code - Added subscriber events for model and view-model code - Removed UI timer for forcing updates - Provided more methods to safely set values going down the chain - Separated out the GUI and common code into separate libraries for future use Notably, on my development machine, this decreased CPU usage by a fair bit, especially at idle. As a bonus, since it came up during the refactoring and testing, hidden tracks can now play properly and are controlled by an internal flag set by the settings with the current UI (fixes #10). This ended up being a pretty major thing to address as part of this PR, because a lot of the behavior that was causing hidden tracks to render incorrectly was tied to a poor implementation of track loading and switching. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-30 21:23:14 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: aaru-dps/RedBookPlayer#62