I've a WPF application where the user can add pages, delete pages, fill out forms, create graphs .... etc. What is the best approach to save the application at run time as a project file like (*.csproj in c#) and be able to load it later.
Asked
Active
Viewed 585 times
1
-
1You'll need to devise your own file-format. Keep it as simple as possible (nothing wrong with using plain-text). JSON is also popular right now - just write out the state of your application to JSON nodes, save to a file, and write code that does it in reverse (read the file, populate the UI) to open it. – Dai Apr 08 '16 at 18:21
-
As best as I understand the question, Visual Studio is the best answer. – Sam Hobbs Apr 08 '16 at 18:42
-
We have the same capability, but use a DB to store the layout via multiple tables: Pages, Controls, ControlProperties. We have the capability of exporting and reimporting that and used an XML format for that. That seems to be working very well as you can specify schema validations. – Frank J Apr 08 '16 at 18:42
-
1You could simply serialize your model objects and save them. You can deserialize them later to restore state. – wingerse Apr 08 '16 at 18:53
-
Possible duplicate: http://stackoverflow.com/questions/6115721/how-to-save-restore-serializable-object-to-from-filebinary-serialization&usg=AFQjCNE4MzjEPl8aHUNC-NLP_9IhL675Tg&bvm=bv.119028448,d.amc – Apr 09 '16 at 18:21