free geoip ApplicationSettingsBase Event Issue -- Solution - Jayson's Blog - jaysonKnight.com
jaysonKnight.com
Welcome to my corner of the internet

ApplicationSettingsBase Event Issue -- Solution

In my last post about the apparent strangeness going on with the lack of a SettingsSaved event, I may have jumped the gun a little bit (who me? Never).  Thommi left a comment asking why any of the classes needed to know if a configuration setting was persisted to disk, which wasn't the case so I probably worded it wrong.  What I needed was a notification from the configuration subsystem that A) a setting had changed and B) what the new value was.  In this case, I was hooking up to the PropertyChanged event, then attempting to re-read specific configuration values back in from disk.  The problem is that the PropertyChanged event fires before any values are actually persisted, as do SettingsChanging and SettingsSaving.  What I didn't realize is that the SettingsChangingEventArgs exposes a NewValue property, which is what I was looking for all along, and will actually end up saving me a round trip reading from disk.

So it was there all along, and done in a better way than exposing a SettingsSaved event.  Hopefully this will save someone else the head scratching I went through.


Posted Jan 26 2007, 06:17 PM by Jayson Knight

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

Copyright © :: JaysonKnight.com
External Content © :: Respective Authors

Terms of Service/Privacy Policy