SessionFile
Static helpers for capturing, persisting and restoring a SessionRecord on disk. The on-disk record lives in Folders.LocalAppDataFolder and is written at shutdown; the next startup reads it and reinstates the documents that were open when the previous session ended.
Fields
Properties
Methods
CaptureCurrent
#Build a fresh SessionRecord from the current state of a document bag. Every non-empty stack root is captured — named documents reference their on-disk path, unnamed documents reference their runtime identity and an autosave file under Folders.UnnamedFilesFolder.
Parameters:
| bag (DocumentBag) |
Returns: A new record. Never null, but may have zero entries.
TryDelete
#Delete the session record file. The restore path no longer calls this; the next clean shutdown overwrites the record. Available for explicit "forget my session" operations.
TryLoad
#Read the session record from disk, or return null if no record exists or the file could not be read.
TrySave
#Write the supplied record to Path, replacing any existing file.
Parameters:
| record (SessionRecord) |
Returns: True on success.