public SettingsUpgrader(ISettingsStore settingsStore, IApplicationDescriptor applicationDescriptor, IShellLocks locks, ProductSettingsLocation productSettingsLocation, RunsProducts.ProductConfigurations productConfigurations) { var boundSettingsStore = settingsStore.BindToContextTransient(ContextRange.ManuallyRestrictWritesToOneContext((l, contexts) => contexts.Empty)); Expression<Func<ZenCodingSettings, bool>> isUpgradedProperty = settings => settings.IsUpgraded; if (!boundSettingsStore.GetValue(isUpgradedProperty)) { var settingsComponent = new ShellSettingsComponent(applicationDescriptor, locks, productSettingsLocation, productConfigurations); var oldSettings = new Settings(); settingsComponent.LoadSettings(oldSettings, XmlExternalizationScope.UserSettings, oldSettings.GetType().Name); for (int i = 0; i < oldSettings.FileAssociations.Count; i++) { var association = oldSettings.FileAssociations[i]; boundSettingsStore.SetIndexedValue((ZenCodingSettings settings) => settings.FileAssociations, i, association); } boundSettingsStore.SetValue(isUpgradedProperty, true); } }
public SettingsUpgrader(ISettingsStore settingsStore, IApplicationDescriptor applicationDescriptor, IShellLocks locks, ProductSettingsLocation productSettingsLocation, RunsProducts.ProductConfigurations productConfigurations) { var boundSettingsStore = settingsStore.BindToContextTransient(ContextRange.ManuallyRestrictWritesToOneContext((l, contexts) => contexts.Empty)); Expression <Func <ZenCodingSettings, bool> > isUpgradedProperty = settings => settings.IsUpgraded; if (!boundSettingsStore.GetValue(isUpgradedProperty)) { var settingsComponent = new ShellSettingsComponent(applicationDescriptor, locks, productSettingsLocation, productConfigurations); var oldSettings = new Settings(); settingsComponent.LoadSettings(oldSettings, XmlExternalizationScope.UserSettings, oldSettings.GetType().Name); for (int i = 0; i < oldSettings.FileAssociations.Count; i++) { var association = oldSettings.FileAssociations[i]; boundSettingsStore.SetIndexedValue((ZenCodingSettings settings) => settings.FileAssociations, i, association); } boundSettingsStore.SetValue(isUpgradedProperty, true); } }
public AssemblyListOwner(Lifetime lifetime, IAssemblyExplorerManager assemblyExplorerManager, ShellSettingsComponent shellSettings) { this.assemblyExplorerManager = assemblyExplorerManager; shellSettings.LoadSettings(lifetime, this, XmlExternalizationScope.WorkspaceSettings, "AssemblyLists"); }