My program asks to save to a configuration file every time the user exits from the program, even if there were no changes made to the various input controls. Now, I am being asked to only to save when changes are made. A lot of times the user will only open up the configuration file to only view the parameters and they get worried when it asks to save changes when they didn’t make any. I was in the process of modifying every control’s “change event” to update a global change flag. After the 10th control out of 40, I thought there must be a better way. Now I am looking for a strategy or design pattern to implement this.
Share
I am not sure what format your configuration is stored in, but here is the general idea of what I would do.
When the program closes, serialize your configuration to a temporary variable or file and compare it with the saved configuration. If they are different, prompt the user.