Reputation: 369
I use the Properties.Settings.Default to save the user settings of my program. This includes the size and position of the Main Window. See the Picture here. These represent the default values asigned when I call
Properties.Settings.Default.Reset();
When I call
Properties.Settings.Default.Height = 25;
for example, the user setting gets saved as 25 by calling
Properties.Settings.Default.Save();
When I now go for reset() and save(), the default value I chose in the Picture are again given back when calling
Properties.Settings.Default.Height;
How can I change these default values during runtime so that when I call reset(), my newly assigned values are being taken? (Even when I close the program and reopen again. It should consequently update in the Picture as well)
Upvotes: 1
Views: 928
Reputation: 111
Changing Settings.Default shouldn't be a problem if parameters scope set to User. Parameters in Application scope are read-only. Here is my setup.
Then I use it in public field for two way binding like so.
public double CurrRateRubToUSD
{
get
{
return Properties.Settings.Default.CurrencyRateRubToUSD;
}
set
{
if (value != Properties.Settings.Default.CurrencyRateRubToUSD)
{
Properties.Settings.Default.CurrencyRateRubToUSD = value;
Properties.Settings.Default.Save();
Properties.Settings.Default.Reload();
}
}
}
Upvotes: 2