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 16 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
different code fixes
  • Loading branch information
htcfreek committed Feb 25, 2025
commit 609faa7408a15c94deea87cf2fdd5287baa972b1
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
{
private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread();

// Indicator if we loaded or reloaded a file
// Indicator if we loaded/reloaded/saved a file and need to skip TextChangedEevent one time.

Check warning on line 26 in src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Events.cs

GitHub Actions / Check Spelling

`Eevent` is not a recognized word. (unrecognized-spelling)
private static bool newFileLoaded;

/// <summary>
@@ -174,20 +174,18 @@

// save and update window title
_ = SaveFile();
_updateWindowTitleFunction(_appFileName);
}

/// <summary>
/// Uses a picker to save out a copy of the current reg file
/// </summary>
private async void SaveAsButton_Click(object sender, RoutedEventArgs e)
{
if (!AskFileName(true))
if (!AskFileName(true) || !SaveFile())
{
return;
}

_ = SaveFile();
UpdateToolBarAndUI(await OpenRegistryFile(_appFileName));
}

Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ private async Task<bool> OpenRegistryFile(string filename)

// update the current window's title with the current filename
_updateWindowTitleFunction(filename);
UpdateUnsavedFileIndicator(false);

// Load in the whole file in one call and plop it all into editor
FileStream fileStream = null;
@@ -990,6 +991,7 @@ private bool SaveFile()
streamWriter.Close();

// only change when the save is successful
_updateWindowTitleFunction(_appFileName);
UpdateUnsavedFileIndicator(false);
saveButton.IsEnabled = false;
}
Loading
Oops, something went wrong.