public static DistributedApplicationData AddFilePersistence( this DistributedApplicationData applicationData , IServiceProvider provider , ISettingsMetadata metadata , SettingsScopes settingsScope = SettingsScopes.Both , string localRootPath = ".\\Local" , string roamingRootPath = ".\\Roaming") { FilePersistenceManager.Build(provider); if (settingsScope == SettingsScopes.Both || settingsScope == SettingsScopes.Local) { FilePersistenceManager.Current.AddApplicationData( applicationData.LocalSettings, settingsScope); } if (settingsScope == SettingsScopes.Both || settingsScope == SettingsScopes.Roaming) { FilePersistenceManager.Current.AddApplicationData( applicationData.RoamingSettings, settingsScope); } applicationData.DataChanged += ApplicationDataOnDataChanged; return(applicationData); }
private static void ApplicationDataOnDataChanged(DistributedApplicationData sender, DistributedApplicationDataContainer container) { //var local = (FilePersistenceManager.Current.Metadata.AppName, SettingsScopes.Local); //FilePersistenceManager.Current.UpdateFile(FilePersistenceManager.Current.ApplicationData[local]); //var roaming = (FilePersistenceManager.Current.Metadata.AppName, SettingsScopes.Roaming); //FilePersistenceManager.Current.UpdateFile(FilePersistenceManager.Current.ApplicationData[roaming]); }