What is the best practice to handle application's settings contains in the external INI file between several forms?
Suppose that I have two forms -- MainForm
and SettingsForm
. User can open the SettingsForm
from the MainForm
. Now I have smth like this:
- On
Load
event of theSettingsForm
I read application's settings from the file and change the UI appropriately - On "Save" button press I write new options' values to the file
- On the "SettingsFormClosed" event of the
MainForm
I read the settings from the file again
I think that the last thing is the most terrible in this case. Maybe I should use smth like SettingsSingleton
or smth like this? What is the best practice to do it in C# and Windows Forms?
Thanks in advance.