保存用户首选项的最佳方法? [英] Best way for Saving User Preferences?

查看:88
本文介绍了保存用户首选项的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算在我的应用程序中添加一个Preferences表单,并使用

Property Grid向用户显示首选项。您认为

是将这些首选项保存到XML文件的最佳方式?使用

CAB(配置应用程序块)?将首选项保存在类

对象中并将它们序列化为XML文件?把它们直接写到

的XML文件中?其他方式???


只想一起思考...想要一种简单易用的方式和b / b
灵活(即可以添加/删除首选项)以后没有太多的麻烦

或让用户放弃所有他们的偏好并重新开始)。


想法?


Tom

解决方案

http://msdn.microsoft.com/library/de.../html/cmab。 asp


-


OHM(Terry Burns)

。 。 。单手人。 。

如果你需要我的电子邮件,请问我


当你不知道自己在做什么时,过得很快


汤姆 < to*@nospam.com>在留言中写道

news:或************** @ TK2MSFTNGP11.phx.gbl ...

我打算加入我的应用程序的首选项表单,并使用
属性网格向用户显示首选项。您认为将这些首选项保存到XML文件的最佳方法是什么?使用
CAB(配置应用程序块)?将首选项保存在类对象中并将它们序列化为XML文件?把它们直接写到
XML文件中?其他方式???

只是想要一起思考...想要一种简单灵活的方式(即可以在以后添加/删除首选项而不会有太多麻烦<或者让用户抛弃他们所有的偏好并重新开始。

想法?

Tom



特里:你的回答给我留下了更多的问题。例如,我已经在我的应用程序中使用CMAB来读取我用于提供控制设置的基础设置文件。这些设置来自服务器文件,并且用户不会更改
- 仅限我自己。正如我所看到的,CMAB除了MyApp.exe.config文件之外无法读取
(即我希望实际用户

首选项设置存储在另一个XML文件中,例如作为AppSettings.xml -

并且CMAB不能被告知''读''这个文件'。


另外,即使我确实使用了CMAB,你是说最好的方式是手动填充CMAB?
?请记住,我将使用Property Grid

将设置与用户连接。是不是简单地序列化我绑定到Property Grid的

类就足够了?或者是否有更大的问题

这个?


不要错误的想法 - 我愿意使用CMAB。我只是没有看到任何

的方式来读取除基本配置文件以外的任何内容,因为我使用那个

文件来为我提供硬编码信息用户,我不能用它来存储用户

首选项。再一次,不要试图回答我自己的问题,而只是好奇

我能做到的各种方式(以及最合乎逻辑的)。

谢谢。


汤姆

单手男子(OHM - Terry Burns) < news.microsoft.com>在消息中写道

news:ed ************* @ TK2MSFTNGP11.phx.gbl ...

http://msdn.microsoft .com / library / de ... / html / cmab.asp
-

OHM(特里伯恩斯)
。 。 。单手人。 。
如果你需要我的电子邮件,请问我

当你不知道自己在做什么时,过得很快

汤姆 < to*@nospam.com>在消息中写道
新闻:或************** @ TK2MSFTNGP11.phx.gbl ...

我打算添加一个首选项表单给我的应用程序并使用
属性网格向用户显示首选项。您认为将这些首选项保存到XML文件的最佳方法是什么?使用


CAB(配置应用程序块)?将首选项保存在类对象中并将它们序列化为XML文件?将它们直接写入
到XML文件?其他方式???

只是想要一起思考...想要一种简单灵活的方式(即可以在以后添加/删除首选项而不需要大量的
麻烦或让用户放弃所有偏好并重新开始)。

想法?

Tom




" Tom" < to*@nospam.com>在留言中写道

news:或************** @ TK2MSFTNGP11.phx.gbl ...

我打算加入我的应用程序的首选项表单,并使用
属性网格向用户显示首选项。您认为将这些首选项保存到XML文件的最佳方法是什么?使用
CAB(配置应用程序块)?将首选项保存在类对象中并将它们序列化为XML文件?把它们直接写到
XML文件中?其他方式???




Tom,


这个MSDN Mag有几个好主意。文章:
http:// msdn.microsoft.com/msdnmag/is...s/default.aspx


讨论使用隔离存储,注册等...我个人喜欢

使用XML,因为它比其他

存储(INI,IS或注册表)更加便携和可扩展。另外,我通常使用XML Serializer和

创建对象来表示设置。但这只是我的偏好。


无论你做什么,要记住的关键点是存储,运行时

表示和演示给用户(结合

设置的存储方式)。


Jeremy


I am planning on adding a Preferences form to my application and using the
Property Grid to display the preferences to the user. What do you think
would be the best way to save these preferences out to an XML file? Use the
CAB (Configuration Application Block)? Save the preferences in a class
object and serialize them out the the XML file? Write them out directly to
the XML file? Other ways???

Just want to get some thoughts together... want a way that is easy and
flexible (i.e. can add/remove preferences later on without a lot of hassle
or making the user ditch all their preferences and start over).

Thoughts?

Tom

解决方案

http://msdn.microsoft.com/library/de.../html/cmab.asp

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don''t know what you''re doing

"Tom" <to*@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP11.phx.gbl...

I am planning on adding a Preferences form to my application and using the
Property Grid to display the preferences to the user. What do you think
would be the best way to save these preferences out to an XML file? Use the CAB (Configuration Application Block)? Save the preferences in a class
object and serialize them out the the XML file? Write them out directly to
the XML file? Other ways???

Just want to get some thoughts together... want a way that is easy and
flexible (i.e. can add/remove preferences later on without a lot of hassle
or making the user ditch all their preferences and start over).

Thoughts?

Tom



Terry: Your answer leaves me with even more questions. For instance, I
already use the CMAB in my application to read a ''base'' settings file that I
use to supply control settings. These settings come from a server file and
are NOT changed by the user - only myself. As I see it, the CMAB cannot read
anything but the MyApp.exe.config file (i.e. I would want the actual user
preferences settings stored in another XML file such as AppSettings.xml -
and the CMAB cannot be told to ''read'' this file instead).

Also, even if I did use the CMAB, are you saying that the best way would be
to manually populate the CMAB? Remember, I am going to use a Property Grid
to interface the settings to the user. Would not simply serializing the
class that I ''bind'' to the Property Grid suffice? Or are there bigger issues
to this?

Don''t get the wrong idea - I am open to using the CMAB. I just don''t see any
way for it to read anything but the base config file, and since I use that
file to supply hard-coded info to my users, I can''t use it to store user
preferences. Again, not trying to answer my own question, but just curious
of the various ways I could do this (and what would be the most logical).
Thanks.

Tom
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:ed*************@TK2MSFTNGP11.phx.gbl...

http://msdn.microsoft.com/library/de.../html/cmab.asp
--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don''t know what you''re doing

"Tom" <to*@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP11.phx.gbl...

I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think
would be the best way to save these preferences out to an XML file? Use


the

CAB (Configuration Application Block)? Save the preferences in a class
object and serialize them out the the XML file? Write them out directly to the XML file? Other ways???

Just want to get some thoughts together... want a way that is easy and
flexible (i.e. can add/remove preferences later on without a lot of hassle or making the user ditch all their preferences and start over).

Thoughts?

Tom




"Tom" <to*@nospam.com> wrote in message
news:Or**************@TK2MSFTNGP11.phx.gbl...

I am planning on adding a Preferences form to my application and using the
Property Grid to display the preferences to the user. What do you think
would be the best way to save these preferences out to an XML file? Use
the
CAB (Configuration Application Block)? Save the preferences in a class
object and serialize them out the the XML file? Write them out directly to
the XML file? Other ways???



Tom,

There are several good ideas in this MSDN Mag. article:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

It discusses using isolated storage, registery, etc... I personally like
using XML because it''s so much more portable and expandable than other
storage (INI, IS or Registry). Also, I usually use the XML Serializer and
create objects to represent the settings. But that''s just my preference.

Whatever you do, the key points to keep in mind are storage, run-time
representation, and presentation to the user (in conjunction with how the
settings are stored).

Jeremy


这篇关于保存用户首选项的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆