SabreTools / MPF

Redumper/Aaru/DiscImageCreator GUI in C#
GNU General Public License v3.0
428 stars 34 forks source link

Fix media combobox not updating #568

Closed Deterous closed 1 year ago

Deterous commented 1 year ago

The media type combo box was not updating on user selection, due to the detected media type being chosen first. I have solved this by clearing the detected media type variable once it has been used.

If you want to preserve the variable, then you can fix this a cleaner way, however pressing 'Scan for discs' does still revert the combo box to the detected media, so this change does do as expected.

mnadareski commented 1 year ago

It only looks like the selected index is not updating, not necessarily that the internal data isn't. I tried this out without changes and internally the value was correct.

mnadareski commented 1 year ago

I believe I found the actual culprit. At MainViewModel.cs:L1329 the current disc type is still being set, which is what is causing this double assignment. That was necessary back with the old way of updating, but removing just that line also works as it should. Please try that instead and update your PR when you have a chance. The closure above was accidental.

Deterous commented 1 year ago

Yes, not calling SetCurrentDiscType at all does have the same functionality, I've changed it to that now. As long as SetCurrentDiscType doesn't require being called in all cases.

mnadareski commented 1 year ago

That shouldn't be needed anymore. It was when the UI and internals were out of sync, unfortunately.