I'm trying to share my application-settings between different assemblies as readonly object (e.g. a Dictionary).
The Settings are the default ones used by WPF-applications. I want to enable the user to changed some settings before starting the action inside the WPF-application.
I only need the current settings-values as readonly to send them to the other assemblies.
Currently I have this in my MainWindows OnLoaded-callback.
var t = Settings.Default.PropertyValues.Cast<SettingsPropertyValue>().ToDictionary(value => value.Name, value => value.PropertyValue);
t is the Dicitionary I want to share/pass to the other assemblies that work on them (but do not change them).
However, Settings.Default.PropertyValues is empty and so is t.
My MainWindow already has some user-interface(s) to set some of those values like:
Settings.Default.ProjectRootDirectory = newFolder;
Settings.Default.Save();
var t = Settings.Default.PropertyValues.Cast<SettingsPropertyValue>().ToDictionary(value => value.Name, value => value.PropertyValue);
Settings.Default.Reload();
After setting Settings.Default.ProjectRootDirectory = newFolder, Settings.Default.PropertyValues has all properties loaded correctly.
How can I have the current setting-values without setting one before?