You might want to try Isolated File Storage, where you can save/load your settings to the local hard drive. Doing so is very easy, just a few lines of code.
i think that The Silverlight have some statement that behave like Exec
No it doesn't :)
Edit: ok, here is a guideline on how you might go about applying your locally saved settings to your UI elements.
First up, decide on an interface that your settable controls will implement:
public interface IMySettableSettingsControl
{
Dictionary<string, object> RetrieveSettings();
void ApplySettings(Dictionary<string, object> settings);
}
Now add this interface to your controls that will persist their settings locally:
public MyControl : IMySettableSettingsControl
{
public void ApplySettings(Dictionary<string, object> settings)
{
if (settings.Key.Contains("TextboxContents"))
someTextBox.Text = (string) settings["TextboxContents"];
if (settings.Key.Contains("Height"))
this.Height = (double) settings["Height"];
((IMySettableSettingsControl) someChildControl).ApplySettings( (Dictionary<string, object>) settings["MyChildControl"])
}
public Dictionary<string, object> RetrieveSettings()
{
Dictionary<string, object> localSettings = new Dictionary<string, object>();
localSettings.Add("Height", this.Height);
localSettings.Add("TextboxContents", someTextBox.Text);
localSettings.Add("MyChildControl", ((IMySettableSettingsControl) someChildControl).RetrieveSettings();
}
}
Of course you can get as fancy as you like with this - what i have illustrated above is simply an example. What i have done in the past is have my MainPage.cs file load the settings from Isolated Storage, and then pass the Dictionary in on the constructor of each controller it creates, each controller will then pass it on to each view it creates. To save the settings, i handle the Exit event of the Application:
Application.Current.Exit += new EventHandler(Current_Exit);
and then in the handler:
private void Current_Exit(object sender, EventArgs e)
{
Dictionary<string, object> settings = new Dictionary<string, object>();
//call each UI control or controller, passing in the settings object
//now i can persist the settings dictionary to IsolatedStorage
}
Of course when i do this i use a custom data object for persisting my settings, and i have the option of calling a webservice to retrieve default settings if a local instance is not found (or is found to be corrupt, because the saving of it was interrupted for some reason).
So take the above example, slice it and dice it and change it to suit your needs. Hope it helps.