Link to home
Start Free TrialLog in
Avatar of gromul
gromul

asked on

How to synchronize settings file and UI

I have UI controls bound to properties in the settings file. The user can modify the settings through the UI before the execution. When the user presses Start, the settings in UI are read and the execution begins.

Now, since the UI controls are in different tabs, some of the settings never get read if all the tabs weren't accessed. Is there a way to programmatically make the UI get the settings without it having to be accessed by the user?

Thanks
Avatar of ZachSmith
ZachSmith
Flag of United States of America image

What exactly do you mean when you say "Now, since the UI controls are in different tabs, some of the settings never get read if all the tabs weren't accessed"?

Are you saying that the user must put focus on the tab before the settings are added?
ASKER CERTIFIED SOLUTION
Avatar of chrissie1
chrissie1
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gromul
gromul

ASKER

No, but it seems that's how UI bound to settings works: it doesn't read from the settings file until the user accesses the UI.
I.e. I have 2 tabs and two settings: tab1 and checkBox1 and tab2 and checkBox2. checkBox1 is bound to bool setting1 set to true, and checkBox2 is bound to bool setting2 set to true. Now in my ReadSettings method I have bool setting1 = checkBox1.Checked; bool setting2 = checkBox2.Checked;

If I access both tabs first, setting1 and setting2 will be set to true as expected. If I start the execution without accessing the tab2, setting1 will be true, but setting2 will still be false, as the checkbox2 wasn't properly initialized with the setting2 in the settings file.
Avatar of gromul

ASKER

Yes, I'm using data binding. It's not very flexible, but selecting tabs inside suspend/resume layout is working so I'll go with that.

Thanks!