tags:

views:

443

answers:

1

Hello, I have been using in some projects a xml library for my settings saving, how it worked was like this :

saveSettings(Control control, XmlConfig config, string controlName)

It would then search all the controls inside that one (recursively), calling itself each time it found a new control, etc, and saving all their info to a xml file like :

And then load them back.

Last time I used it was in Framework 2, recently I needed it again, and re-used it, it saves the XML file like normal, but doesnt seem to update the forms after loading xml file, and I cant seem to find why, all code seems correct.

Anyone know a nice replacement? (the default one, application settings, uses an approach that plainly sucks, does approach of specifying a control to save is much more simple and works everywhere)

Thanks in advance =)

A: 

Well, I do this but more explicitly than what your describing. I put together a set of interfaces and classes to support this some time ago. They are used like the following:

readonly ObjectSerializer _serializer;
public MyForm()
{
 _serializer = new ObjectSerializer(this,
  "Top", "Left", "Height", "Width",
  "_splitter.SplitterDistance");
 _serializer.ContinueOnError = true;
}

private void Form_Load(object sender, EventArgs e)
{
 _serializer.Deserialize(new CSharpTest.Net.Serialization.StorageClasses.UserSettingStorage());
}

void Form_Closing(object sender, FormClosingEventArgs e)
{
 _serializer.Serialize(new CSharpTest.Net.Serialization.StorageClasses.UserSettingStorage());
}

The library being used "CSharpTest.Net.Library.dll" is found at:

http://code.google.com/p/csharptest-net

csharptest.net
Where is this ObjectSerializer ? (the using statement)
SilentWarrior
Found it, but, how do you save it afterwards? I dont see a method for getting the code :/
SilentWarrior
Serialize and Deserialize are voids btw
SilentWarrior