0

I have a wpf app and a bunch of read/write settings that need to be accessible from various viewmodels. a setting can be any type (string, bool, etc) and all are settable, but only from a 'Settings' view. I also need the viewmodels to be notified when any setting has been updated and which one that was.

Right now I have a threadsafe singleton called Settings and here's some pseudocode:

class Settings{
    //singleton standard stuff here...
    public int PropertyX {get; set{ TriggerNotification(thePropertyName) }

    //observer pattern
    public void AddListener(IListener listener) {}
    private void TriggerNotification(){ notify all listeners which setting was changed and with what value }
}

My question is, is this a good solution? Should I maybe post this with some real code on the codereview site instead?

Mr Balanikas
  • 1,657
  • 15
  • 28

0 Answers0