public static UserSettingsUpgradeStep Create(Type settingsClass) { //Important: this line first so we can't get into infinite recursion issues with trying //to migrate the UpgradeSettings class on first access (SettingsStoreSettingsProvider does that). if (!ApplicationSettingsHelper.IsUserSettingsMigrationEnabled(settingsClass)) { return(null); } if (!new SettingsGroupDescriptor(settingsClass).HasUserScopedSettings) { return(null); //no point } if (!UpgradeSettings.IsUserUpgradeEnabled()) { return(null); } if (UpgradeSettings.Default.IsUserUpgradeStepCompleted(settingsClass.FullName)) { return(null); } ApplicationSettingsBase settings = ApplicationSettingsHelper.GetSettingsClassInstance(settingsClass); return(new UserSettingsUpgradeStep(settings)); }
public ICollection <UserUpgradeStep> CreateSteps() { var upgradeSteps = new List <UserUpgradeStep>(); if (UpgradeSettings.IsUserUpgradeEnabled()) { foreach (var group in SettingsGroupDescriptor.ListInstalledSettingsGroups()) { try { UserSettingsUpgradeStep step = UserSettingsUpgradeStep.Create(group); if (step != null) { upgradeSteps.Add(step); } } catch (Exception e) { Platform.Log(LogLevel.Warn, e, "Unable to migrate user settings: {0}", group.Name); } } } return(upgradeSteps); }
public static IUserUpgradeStrategy Create() { if (!UpgradeSettings.IsUserUpgradeEnabled()) { return(null); } ICollection <UserUpgradeStep> steps = UserUpgradeStep.CreateAll(); if (steps.Count == 0) { return(null); } return(new UserUpgradeStrategy(steps)); }