![]() This will apply any previously stored data and start listening for "WindowClosed" event to persist new data. settings file (Scenario A) versus Jot (Scenario B). To illustrate the basic idea, let's compare two ways of dealing with this requirement. Install-package Jot Example: Persisting the size and location of a Window ![]() Jot is available on NuGet and can be installed from the package manager console: This is a better abstraction for this requirement, resulting in more readable and concise code. With Jot, you only need to declare which properties of which objects you want to track, and when to persist and apply data. This code is generally tedious, error-prone and no fun to write. This involves writing a lot of boilerplate code to copy that data back and forth. settings file and read and update it as needed. ![]() username, selected tab indexes, recently opened files.)Ī common approach is to store this data in a. Sizes and locations of movable/resizable elements of the UI (forms, tool windows, draggable toolbars.).NET library for state persistenceĪlmost every application needs to keep track of its own state, regardless of what it otherwise does.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |