mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-04 06:51:35 -05:00
A nest window gave no sign that its nest had changed since the last save, and closing it (or the app) discarded the edits silently. The undo history already tracks a save point, so the title now ends in " *" while the nest is off it (or holds an edit no scope recorded), and closing asks to save, discard or cancel. Yes saves through the storage in use; a database save cancels the close and closes the window once the upload succeeds. Saves now commit any unrecorded edit first so the save point covers what was written. The window's cleanup moves from OnClosing to OnFormClosed: another window can still cancel closing the app, and a nest window must not lose its plate manager when that happens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
706 B
C#
21 lines
706 B
C#
using System.Runtime.CompilerServices;
|
|
using System.Windows.Forms;
|
|
using OpenNest.Forms;
|
|
using OpenNest.Properties;
|
|
|
|
namespace OpenNest.WinForms.Tests;
|
|
|
|
internal static class IsolatedUserSettings
|
|
{
|
|
#pragma warning disable CA2255 // Must run before anything reads Settings.Default.
|
|
[ModuleInitializer]
|
|
internal static void Redirect()
|
|
{
|
|
AppDataSettingsProvider.PathOverride = Path.Combine(
|
|
Path.GetTempPath(), "OpenNest.WinForms.Tests", Guid.NewGuid().ToString("N"), "user-settings.json");
|
|
// A closing nest window never waits on the unsaved-changes message box.
|
|
EditNestForm.UnsavedChangesPrompt = _ => DialogResult.No;
|
|
}
|
|
#pragma warning restore CA2255
|
|
}
|