简体   繁体   English

在C#Wpf上保存数据

[英]Saving Data On C# Wpf

How can I save my added buttons when closing the program ? 关闭程序时如何保存添加的按钮? Each time I hit an add button I'm creating a new title which type is button.And each title have it's own specific words.So I must save the words in buttons at the same time. 每次我按下添加按钮时,我都会创建一个新的标题,其类型为button。每个标题都有其自己的特定单词,因此我必须同时将这些单词保存在button中。

在此处输入图片说明

  • Find out what data needs to be stored. 找出需要存储哪些数据。 > Define a Model >定义模型
  • Define how the Data will be stored > eg XML-Serialisation, JSON or whatever 定义如何存储数据>例如XML序列化,JSON或其他
  • Define where Data will be stored, eg Database, File 这里定义的数据将被存储,例如数据库,文件
  • Define when the Configuration is read and saved 定义何时读取和保存配置
    • eg: read on startup, save on shutdown 例如:启动时读取,关机时保存
  • Handle your Configuration Data to generate your buttons 处理您的配置数据以生成按钮

Its all up to you. 这一切都取决于你。 :) :)

An easy solution might be using XmlSerializer , which is documented here . 一个简单的解决方案可能是使用XmlSerializer在此处进行了介绍

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM