What's the way to implement Save / Load functi

2019-02-03 19:11发布

I'm trying to implement a Load / Save function for a Windows Forms application.

I've got following components:

  • A tree view
  • A couple of list views
  • A couple of text boxes
  • A couple of objects (which holds a big dictionarylist)

I want to implement a way to save all of this into a file, and resume/load it later on.

What's the best way to do this?

I think XML serialization is the way to go, but I'm not quite sure how, or where to start. Or will it require a really complex solution to be able to do this?

7条回答
Root(大扎)
2楼-- · 2019-02-03 19:59

it is fairly trivial to use data-binding to tie an object model to the UI.

How can I tie an object with a GUI control without a persistent storage? If I do it manually that means I have to write ridiculous amount of code for every single object in memory. I already have some sort of class storage for this data but it's not bind sort scenario, it's like read this write here.

Am I supposed to write a loader which loads serialized XML and get the object and then read the object and fill up the whole GUI? Obviously this more like manual loading not binding. Am I missing something ?

查看更多
登录 后发表回答