C# 应用程序保存
我使用 Visual Studio 2010 在 C# 中创建了一个应用程序。该应用程序使用数据库和大量数据绑定控件。
我需要保存正在运行的应用程序的副本,其中包含用户对文件所做的更改,他们可以双击并将保存的状态返回到应用程序中。
我知道我需要使用 SaveFileDialog 但除此之外我不知道。
I have created an application in C# using visual studio 2010. The application uses a database and a ton of data bound controls.
I need to save a copy of the running application with what changes the user has made to a file they can double click and get their saved state back in the application.
I know I need to use a SaveFileDialog but other than I have no idea.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果所有控件都通过数据集绑定到数据,您也许可以将底层数据集序列化到 XML 文件或从 XML 文件反序列化,以创建某种“离线数据文件存储”功能。
但是,在将此类功能引入应用程序之前,您应该考虑通过在应用程序客户端中保存此类保存的状态而可能产生的所有潜在数据库同步问题。
如果您确实只想保留窗口布局属性(例如窗口大小、网格列宽度、排序列、拆分器位置等),则必须仅关注这些属性。
这是一个带有 类似讨论的线程
If all the controls are bound to data through datasets you could perhaps serialize and deserialize the underlying datasets to/from XML files in order to create some kind of "offline data file storage" feature.
Before introducing such a feature into your application you should, however, consider all the potential database synchronization issues that are potentially created though preservation of such a saved state within your application clients.
If you really only want to preserve window layout properties (such as window size, grid column width, sorted column, splitter positions etc) you have to focus on those properties only.
Here is a thread with a similar discussion