TopShelfCustomer/TopShelfCustomer/Services/SettingsContainer.cs
/// <summary>
/// InitializeUserSettings:
///
/// Utilizes the SerializationHelper static methods to
/// either populate the User settings from the settings JSON
/// file or create a new settings file and write the default values to it.
/// </summary>


Utilizes the SerializationHelper static methods to
either populate the User settings from the settings JSON
file or create a new settings file and write the default values to it.
Utilizes the SerializationHelper static methods to either populate the User settings from the settings JSON file or create a new settings file and write the default values to it .
private static void InitializeUserSettings () {
            string currentUserSettingsPath = SettingsFilePath + UserContainer.CurrentUser.Id;       
            if ( SerializationHelper.JsonFileExists( currentUserSettingsPath ) ) {      
                CurrentUserSettings = (UserSettings)SerializationHelper.JsonRead<UserSettings>( currentUserSettingsPath );      
            } else {
                JObject jsonObject = JObject.FromObject( CurrentUserSettings );     
                SerializationHelper.JsonWrite( currentUserSettingsPath, jsonObject.ToString() );       
            }
        }
private static void InitializeUserSettings ( ) { string currentUserSettingsPath = SettingsFilePath + UserContainer . CurrentUser . Id ; if ( SerializationHelper . JsonFileExists ( currentUserSettingsPath ) ) { CurrentUserSettings = ( UserSettings ) SerializationHelper . JsonRead < UserSettings > ( currentUserSettingsPath ) ; } else { JObject jsonObject = JObject . FromObject ( CurrentUserSettings ) ; SerializationHelper . JsonWrite ( currentUserSettingsPath , jsonObject . ToString ( ) ) ; } }
InitializeUserSettings:
InitializeUserSettings :
//Modify path to use current User's settings //Check if JSON file exists //Read JsonFile and populate UserSettings object //Add blank UserSetting object to jsonObject //Write the blank UserSettings to the Settings file