PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.

Best way for Saving User Preferences?

 
 
Tom
Guest
Posts: n/a
 
      28th Sep 2004
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



 
Reply With Quote
 
 
 
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      28th Sep 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
 
Tom
Guest
Posts: n/a
 
      28th Sep 2004
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:(E-Mail Removed)...
>

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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >
> >

>
>



 
Reply With Quote
 
Jeremy
Guest
Posts: n/a
 
      28th Sep 2004
"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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


 
Reply With Quote
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      28th Sep 2004


--

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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?

What types of data can I store?
The Configuration Management Application Block provides support for storing
application configuration data contained in Hashtable objects as well as any
data type supported by the XmlSerializer class. In addition, the extensible
architecture of the Configuration Management Application Block means that
you can easily add support for any data structure with minimal development
effort.

HTH

>
> 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:(E-Mail Removed)...
> >

>

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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > 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
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      28th Sep 2004
I haven't used CMAB much, but I quickly discovered it does NOT handle user
preferences out of the box. In other words, it does not store the xml file
to a user's profile folder. It can be modified to do so, but so much for
plug n play.

just my .02
Greg


"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:(E-Mail Removed)...
>
>
> --
>
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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?

> What types of data can I store?
> The Configuration Management Application Block provides support for
> storing
> application configuration data contained in Hashtable objects as well as
> any
> data type supported by the XmlSerializer class. In addition, the
> extensible
> architecture of the Configuration Management Application Block means that
> you can easily add support for any data structure with minimal development
> effort.
>
> HTH
>
>>
>> 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:(E-Mail Removed)...
>> >

>>

> 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" <(E-Mail Removed)> wrote in message
>> > news:(E-Mail Removed)...
>> > > 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
>> > >
>> > >
>> > >
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      28th Sep 2004
I think you will find that will most applications blocks they are a bit
'Full' of code and posibility, but sometimes can be a bit over the top. If
the OP just wants simple unsecure storage then a serialized output will do.
Isolated storage is another option but truly is a bit weird to work wotk.
Other than that there is allways the registry, or an SQL ( or like )
database storage as a possibility.



--

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

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

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:(E-Mail Removed)...
> I haven't used CMAB much, but I quickly discovered it does NOT handle user
> preferences out of the box. In other words, it does not store the xml

file
> to a user's profile folder. It can be modified to do so, but so much for
> plug n play.
>
> just my .02
> Greg
>
>
> "One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in

message
> news:(E-Mail Removed)...
> >
> >
> > --
> >
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> 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?

> > What types of data can I store?
> > The Configuration Management Application Block provides support for
> > storing
> > application configuration data contained in Hashtable objects as well as
> > any
> > data type supported by the XmlSerializer class. In addition, the
> > extensible
> > architecture of the Configuration Management Application Block means

that
> > you can easily add support for any data structure with minimal

development
> > effort.
> >
> > HTH
> >
> >>
> >> 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:(E-Mail Removed)...
> >> >
> >>

> >

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" <(E-Mail Removed)> wrote in message
> >> > news:(E-Mail Removed)...
> >> > > 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
> >> > >
> >> > >
> >> > >
> >> >
> >> >
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
Rockford Lhotka
Guest
Posts: n/a
 
      28th Sep 2004
Here's one possibility

http://msdn.microsoft.com/vbasic/usi...et07082003.asp

Another is to use the CMAB. In that case, it is best to create a custom
XmlFileStorage provider that does token replacement for %ApplicationData% in
the "path" value - replacing it with
System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData).
You'll also need to alter it to create an empty file if one doesn't exist.
These changes are made in the Init method of the class.

Rocky
--
Rockford Lhotka
Microsoft Software Legend, Regional Director and MVP
Author of the Expert VB.NET & C# Business Objects books
(E-Mail Removed) http://www.lhotka.net


"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>
>



 
Reply With Quote
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      28th Sep 2004
I did suggest this but it was frowned upon.

--

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

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

"Rockford Lhotka" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Here's one possibility
>
>

http://msdn.microsoft.com/vbasic/usi...et07082003.asp
>
> Another is to use the CMAB. In that case, it is best to create a custom
> XmlFileStorage provider that does token replacement for %ApplicationData%

in
> the "path" value - replacing it with
>

System.Environment.GetFolderPath(System.Environment.SpecialFolder.Applicatio
nData).
> You'll also need to alter it to create an empty file if one doesn't exist.
> These changes are made in the Init method of the class.
>
> Rocky
> --
> Rockford Lhotka
> Microsoft Software Legend, Regional Director and MVP
> Author of the Expert VB.NET & C# Business Objects books
> (E-Mail Removed) http://www.lhotka.net
>
>
> "Tom" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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
> >
> >
> >

>
>



 
Reply With Quote
 
scorpion53061
Guest
Posts: n/a
 
      28th Sep 2004
http://www.kjmsolutions.com/xmlsettings.htm



"Tom" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed):
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 7: best firewall and best antivirus and best anti-spamsoftware is/are? RayLopez99 DIY PC 21 3rd Sep 2010 03:27 PM
Best seller,Best service,Provide Best bot cherrytree Windows Vista Games 0 29th Oct 2007 03:33 AM
best way to install apps when logged in user is domain user only =?Utf-8?B?VEo=?= Microsoft Windows 2000 1 22nd Jan 2005 01:25 AM
autologon with restricted user? best way to install software for restricted user? Les Caudle Microsoft Windows 2000 1 11th Oct 2004 01:37 PM
Best way to synchronise data between databases - best approach? Angus Comber Microsoft Access 0 1st Jan 2004 01:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.