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

[RegPreview] Various improvements on how files are saved #37628

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

htcfreek
Copy link
Collaborator

@htcfreek htcfreek commented Feb 25, 2025

Summary of the Pull Request

Important

  • Conflicts with [RegPreview] Init with header and add NEW button #37626 and needs update after this to add the following things to the "NEW" code:
    • Correct handling of save button after loading new file.
    • Stop if save fails.
    • Use new "AskFileName" method.
    • Update "unsaved" indicator.

This PR implements various fixes and improvements into RegistryPreview for saving files:

  1. An unsaved file indicator in the title bar like in Notepad.
  2. The save button behaves like a "save as" button, if the file does not exist on disk like in Notepad.
  3. If the app gets closed without saving and the file does not exist on disk, then the user is now asked for the path.
  4. Failed save actions are handled now correctly on dirty closing, opening files and all other actions that require saving the current state. They will stop the process.
  5. A fix for an incorrect enabled state of the save button after opening, reloading and saving a file.
  6. Reuse file name on save as button, if known. Otherwise use "new file" template name like in Notepad.

image

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Local test build.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@htcfreek htcfreek self-assigned this Feb 25, 2025

This comment has been minimized.

This comment has been minimized.

@htcfreek htcfreek added the Status-Blocked We can't make progress due to a dependency or issue label Feb 25, 2025
@@ -23,6 +23,9 @@ public sealed partial class RegistryPreviewMainPage : Page
{
private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread();

// Indicator if we loaded/reloaded/saved a file and need to skip TextChanged event one time.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Indicator if we loaded/reloaded/saved a file and need to skip TextChanged event one time.
// Indicator if we loaded/reloaded/saved a file and need to skip TextChanged event one time.
// (Solves the problem that enabling the event handler fires it one time.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status-Blocked We can't make progress due to a dependency or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant