xamarin - What would be a good way to replace a static class used to hold Application settings? -


i have application uses static class store settings:

namespace abc {     public static class ms      {         public static bool abc;         public static bool def;         ...     } } 

when app starts goes database , updates of these settings.

i have been told holding them in static class not ideal when doing bindings , adding notification i'm thinking should new class , hold them in instance. if that's case can give me advice. should when application starts , should in constructor of app() if best way how can this. small 4-5 line example big help

public partial class app : application {     public static xxx      public app()     {         as.appupdated = "feb 1, 2017";         as.appversion = "0.1";         initializecomponent();         mainpage = new ms.mainpage();     } } 

have @ james montemagno's settings plugin.

https://github.com/jamesmontemagno/settingsplugin

this abstracts away lot of plumbing around settings , persisting them locally. calling 1 of settings anywhere in application becomes simple calling settings.mysettingname.

when comes binding these values view create property them in view model returns value settings. if need can put them in base viewmodel , go there.

public class myviewmodel : baseviewmodel {  }  public class baseviewmodel {      public bool settinga => settings.settinga;      public bool settingb => settings.settingb; } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -