Closed ghost1372 closed 3 years ago
There is no way to do that built in, The design was to read json once, did not anticipate it to be changed and reloaded during runtime therefore there is no way to listen for changes - nor updating the object on the fly. That shouldn't stop you from creating a class that does just that. Listen to changes in that file using window's api (theres a managed way) and every time there is a change, reload it and store staticly (so the entire app reloads it once and only when its changed). So when you ask for settings, you get "snapshot" of how the file looked at that moment. Every time you need to do something with it, you can access the static provider and get the latest from them. or if you dont care about how old it is then just store the result in your object for later use.
thank you I understood
Hi Is there a way to force the settings to receive new information? for example In Window A, I set the following changes: I define JsonSettings.Load at the top of each class
When I go to Window B, I get Old information instead of new information
var newVal = Setting.IsFirstRun;
If I use the following code where I want to get new information, the problem will be solved
Is there a better way to get the latest changes without redefining the settings?