Extract PromptSaveChanges helper for save-changes dialogs#11987
Merged
Conversation
The five 'Save changes?' Yes/No/Cancel prompts in MainViewModel each repeated the same show-dialog-and-decide block. Extract a PromptSaveChanges helper (plus SaveCurrentSubtitle / SaveCurrentSubtitleOriginal) so the dialog and the cancel/dismiss handling live in one place. Behavior is unchanged: Yes saves and proceeds only if the save succeeds, No discards and proceeds, Cancel or a title-bar dismissal (MessageBoxResult.None) aborts. Net -36 lines. Follow-up to #11985. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #11985.
The five "Save changes?" Yes/No/Cancel prompts in
MainViewModeleach repeated the same show dialog → decide → maybe save block. This extracts a singlePromptSaveChangeshelper (plusSaveCurrentSubtitle/SaveCurrentSubtitleOriginal) so the dialog and — importantly — the cancel/dismiss handling live in one place:Behavior is unchanged:
MessageBoxResult.None) → abort.The two close handlers (
OnClosing,OnWindowClosing) keep callingSaveSubtitle()directly as before (via the inline save lambda); the three text-flow sites keep the save-as-if-untitled logic via the smallSaveCurrent*helpers.Net −36 lines, and the
None(dismissal) handling is no longer duplicated across five call sites.🤖 Generated with Claude Code