/// <summary> /// code here is the same as in the settings serializer, but unfortunately /// we have to duplicate it, otherwise the options dialog did not load (why?) /// </summary> /// <param name="optionName"></param> /// <param name="serviceProvider"></param> /// <returns></returns> private bool GetOption(string optionName, IServiceProvider serviceProvider) { var shellSettingsManager = new ShellSettingsManager(serviceProvider); var store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); var option = store?.GetBoolean(CollectionPath, optionName, false); return option ?? false; }
public Encouragements(SVsServiceProvider vsServiceProvider) { var shellSettingsManager = new ShellSettingsManager(vsServiceProvider); writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); LoadSettings(); }
private SavedOptions() { var shellSettingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); _store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); LoadOptions(); }
/// <summary> /// Displays the tool window the first time the environment is used after installation. /// </summary> internal static void InitializeWindowVisibility(IServiceProvider serviceProvider) { Guard.NotNull(() => serviceProvider, serviceProvider); var settingsManager = new ShellSettingsManager(serviceProvider); var store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); var packageToolWindow = serviceProvider.GetService<IPackageToolWindow>(); if (!(store.CollectionExists(Constants.SettingsName) && store.PropertyExists(Constants.SettingsName, VisibilitySetting))) { //First time after installation packageToolWindow.ShowWindow<GuidanceExplorerToolWindow>(true); store.CreateCollection(Constants.SettingsName); store.SetString(Constants.SettingsName, VisibilitySetting, bool.FalseString); } else { // Afterwards, we load the toolwindow so that the drag&drop events can get access to the // toolwindow usercontrol that handles the operations. // Querying visibility will automatically create the control. packageToolWindow.IsWindowVisible<GuidanceExplorerToolWindow>(); } }
public WhereAmISettings(SVsServiceProvider vsServiceProvider) : this() { var shellSettingsManager = new ShellSettingsManager(vsServiceProvider); writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); LoadSettings(); }
public void Initialize() { var shellManager = new ShellSettingsManager(Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider); this.settingsStore = shellManager.GetWritableSettingsStore(SettingsScope.UserSettings); var collection = SettingsManager.GetSettingsCollectionName(typeof(Foo)); if (this.settingsStore.CollectionExists(collection)) this.settingsStore.DeleteCollection(collection); }
/// <summary> /// code here is the same as in the settings serializer, but unfortunately /// we have to duplicate it, otherwise the options dialog did not load (why?) /// </summary> /// <param name="optionName"></param> /// <param name="serviceProvider"></param> /// <returns></returns> private void SetOption(string optionName, bool value, IServiceProvider serviceProvider) { var shellSettingsManager = new ShellSettingsManager(serviceProvider); var store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!store.CollectionExists(CollectionPath)) store.CreateCollection(CollectionPath); store?.SetBoolean(CollectionPath, optionName, value); }
protected SettingStore() { SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists(CollectionPath)) { userSettingsStore.CreateCollection(CollectionPath); } }
internal VersionProvider(IServiceProvider serviceProvider) { var settingsManager = new ShellSettingsManager(serviceProvider); _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!_settingsStore.CollectionExists(CollectionName)) _settingsStore.CreateCollection(CollectionName); if (_settingsStore.PropertyExists(CollectionName, OldVersionPropertyName)) _settingsStore.DeleteProperty(CollectionName, OldVersionPropertyName); }
public void Initialize() { var components = VsIdeTestHostContext.ServiceProvider.GetService<SComponentModel, IComponentModel>(); var manager = new ShellSettingsManager(VsIdeTestHostContext.ServiceProvider); var store = manager.GetWritableSettingsStore(SettingsScope.UserSettings); if (store.CollectionExists(NuPattern.Runtime.StoreConstants.RegistrySettingsKeyName)) { store.DeleteCollection(NuPattern.Runtime.StoreConstants.RegistrySettingsKeyName); } this.manager = components.GetService<ISettingsManager>(); }
public static VSDropSettings LoadSettingsFromStorage() { var settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); var userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.PropertyExists(collectionName, nameof(VSDropSettings))) return null; var xmlData = userSettingsStore.GetString(collectionName, nameof(VSDropSettings)); if (!string.IsNullOrEmpty(xmlData)) return VSDropSettings.FromXml(xmlData); return null; }
public static void SaveToStorage(VSDropSettings settings) { var settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); var userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists(collectionName)) userSettingsStore.CreateCollection(collectionName); if (settings == null) settings = new VSDropSettings(); var s = settings; userSettingsStore.SetString( collectionName, nameof(VSDropSettings), s.ToXml() ); }
/// <summary> /// Initializes a new instance of the ExtensionSettings class /// </summary> /// <param name="extensionPackage">The extension package</param> public ExtensionSettings(Package extensionPackage) { this.extensionPackage = extensionPackage; var settingsManager = new ShellSettingsManager(this.extensionPackage); var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (configurationSettingsStore.CollectionExists(COLLECTION_NAME)) { this.displayTeamViewerButton = configurationSettingsStore.GetBoolean(COLLECTION_NAME, "ShowAsButton"); this.twoUsersView = configurationSettingsStore.GetBoolean(COLLECTION_NAME, "TwoUsersView"); } else { this.displayTeamViewerButton = false; this.twoUsersView = false; } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { var settingsManager = new ShellSettingsManager(this); var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); UserSettingsManager.Initialize(configurationSettingsStore); TryRegisterAssembly(); //Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary //{ // Source = new Uri("/aspnet_debug.VSExtension;component/Resources/Resources.xaml", UriKind.Relative) //}); var dte = (DTE) GetService(typeof (DTE)); AttachDebugger.Initialize(this, dte); base.Initialize(); }
private void LoadSettings() { _hasLoaded = true; SettingsManager settingsManager = new ShellSettingsManager(serviceProvider); SettingsStore store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings); LogoAdornment.VisibilityChanged += (sender, isVisible) => { WritableSettingsStore wstore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); _isVisible = isVisible; if (!wstore.CollectionExists(Globals.VsixName)) wstore.CreateCollection(Globals.VsixName); wstore.SetBoolean(Globals.VsixName, _propertyName, isVisible); }; _isVisible = store.GetBoolean(Globals.VsixName, _propertyName, true); }
protected override void Initialize() { var settingsManager = new ShellSettingsManager(this); var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); UserSettingsManager.Initialize(configurationSettingsStore); MonoLogger.Setup(); base.Initialize(); var dte = (DTE)GetService(typeof(DTE)); monoExtension = new MonoVisualStudioExtension(dte); TryRegisterAssembly(); Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary { Source = new Uri("/MonoRemoteDebugger.VSExtension;component/Resources/Resources.xaml", UriKind.Relative) }); var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; InstallMenu(mcs); }
protected override void Initialize() { base.Initialize(); OleMenuCommandService menuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (menuCommandService != null) { // This is the drop down combo box itself CommandID comboBoxCommandID = new DebugCommandLineCommandID(DebugCommandLineCommand.DebugCommandLineCombo); OleMenuCommand comboBoxCommand = new OleMenuCommand(HandleInvokeCombo, HandleChangeCombo, HandleBeforeQueryStatusCombo, comboBoxCommandID); menuCommandService.AddCommand(comboBoxCommand); // This is the special command to get the list of drop down items CommandID comboBoxGetListCommandID = new DebugCommandLineCommandID(DebugCommandLineCommand.DebugCommandLineComboGetList); OleMenuCommand comboBoxGetListCommand = new OleMenuCommand(HandleInvokeComboGetList, comboBoxGetListCommandID); menuCommandService.AddCommand(comboBoxGetListCommand); } var shellSettingsManager = new ShellSettingsManager(this); SettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); LoadSettings(); }
/// <summary> /// This is used to save the MEF provider configuration settings /// </summary> /// <remarks>The settings are saved using the <see cref="ShellSettingsManager"/> to the /// <see cref="CollectionPath"/> collection.</remarks> public bool SaveConfiguration() { ShellSettingsManager settingsManager = new ShellSettingsManager(_serviceProvider); WritableSettingsStore settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(CollectionPath)) settingsStore.CreateCollection(CollectionPath); settingsStore.SetBoolean(CollectionPath, "EnableExtendedXmlCommentsCompletion", EnableExtendedXmlCommentsCompletion); settingsStore.SetBoolean(CollectionPath, "EnableGoToDefinition", EnableGoToDefinition); settingsStore.SetBoolean(CollectionPath, "EnableGoToDefinitionInCRef", EnableGoToDefinitionInCRef); return true; }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void MenuItemCallback(object sender, EventArgs e) { // Show a Message Box to prove we were here IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); Guid clsid = Guid.Empty; DeployConfiguration config = new DeployConfiguration(); SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!userSettingsStore.CollectionExists("SyncIIS")) { userSettingsStore.CreateCollection("SyncIIS"); } config.Domain = userSettingsStore.GetString("SyncIIS", "Domain", ""); config.SetSecurePassword(userSettingsStore.GetString("SyncIIS", "Password", "")); config.Site = userSettingsStore.GetString("SyncIIS", "Site", ""); config.Source = userSettingsStore.GetString("SyncIIS", "Source", ""); config.Target = userSettingsStore.GetString("SyncIIS", "Target", "").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToList<string>(); config.Username = userSettingsStore.GetString("SyncIIS", "Username", ""); SyncWindow window = new SyncWindow(config); window.ShowDialog(); var settings = window.Configuration; userSettingsStore.SetString("SyncIIS", "Domain", settings.Domain); userSettingsStore.SetString("SyncIIS", "Password", settings.GetUnsecurePassword()); userSettingsStore.SetString("SyncIIS", "Site", settings.Site); userSettingsStore.SetString("SyncIIS", "Source", settings.Source); userSettingsStore.SetString("SyncIIS", "Target", string.Join(",", settings.Target.ToArray())); userSettingsStore.SetString("SyncIIS", "Username", settings.Username); }
internal VimApplicationSettings(SVsServiceProvider vsServiceProvider, [EditorUtilsImport] IProtectedOperations protectedOperations) { var shellSettingsManager = new ShellSettingsManager(vsServiceProvider); _settingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); _protectedOperations = protectedOperations; }
private void SaveGroupsForSolution(IList<DocumentGroup> groups = null) { var solution = SolutionName; if (string.IsNullOrWhiteSpace(solution)) { return; } if (groups == null) { groups = Groups; } var settingsMgr = new ShellSettingsManager(ServiceProvider); var store = settingsMgr.GetWritableSettingsStore(SettingsScope.UserSettings); if (!store.CollectionExists(StorageCollectionPath)) { store.CreateCollection(StorageCollectionPath); } var propertyName = String.Format(SavedTabsStoragePropertyFormat, solution); if (!groups.Any()) { store.DeleteProperty(StorageCollectionPath, propertyName); return; } var tabs = JsonConvert.SerializeObject(groups); store.SetString(StorageCollectionPath, propertyName, tabs); }
public PackageSettings([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { var sm = new ShellSettingsManager(serviceProvider); settingsStore = new SettingsStore(sm.GetWritableSettingsStore(SettingsScope.UserSettings), Info.ApplicationInfo.ApplicationSafeName); LoadSettings(); }
/// <summary> /// Initializes properties in the package /// </summary> /// <param name="package">The package</param> private void Initialize(ShelvesetComparerPackage package) { SettingsManager settingsManager = new ShellSettingsManager(package); this.writableSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!this.writableSettingsStore.CollectionExists("ShelveSetComparer")) { this.writableSettingsStore.CreateCollection("ShelveSetComparer"); this.ShowAsButton = true; this.TwoUsersView = true; } this.readableSettingStore = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings); }
internal static WritableSettingsStore GetWritableSettingsStore(this SVsServiceProvider vsServiceProvider, SettingsScope scope) { var shellSettingsManager = new ShellSettingsManager(vsServiceProvider); return shellSettingsManager.GetWritableSettingsStore(scope); }
/// <summary> /// Automatically hides the window, if it was automatically opened. /// </summary> internal static void AutoHideWindow(IServiceProvider serviceProvider) { Guard.NotNull(() => serviceProvider, serviceProvider); var settingsManager = new ShellSettingsManager(serviceProvider); var store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (store.CollectionExists(Constants.SettingsName) && store.PropertyExists(Constants.SettingsName, SolutionBuilderAutoOpenedSetting)) { var packageToolWindow = serviceProvider.GetService<IPackageToolWindow>(); packageToolWindow.HideWindow<SolutionBuilderToolWindow>(); store.DeleteProperty(Constants.SettingsName, SolutionBuilderAutoOpenedSetting); } }
/// <summary> /// Automatically opens the window, if not already opened. /// </summary> internal static void AutoOpenWindow(IServiceProvider serviceProvider) { Guard.NotNull(() => serviceProvider, serviceProvider); var packageToolWindow = serviceProvider.GetService<IPackageToolWindow>(); if (!packageToolWindow.IsWindowVisible<SolutionBuilderToolWindow>()) { var settingsManager = new ShellSettingsManager(serviceProvider); var store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!store.CollectionExists(Constants.SettingsName)) { store.CreateCollection(Constants.SettingsName); } store.SetString(Constants.SettingsName, SolutionBuilderAutoOpenedSetting, bool.TrueString); } packageToolWindow.ShowWindow<SolutionBuilderToolWindow>(true); }
public SettingStoreProvider(string collection) { this.collection = collection; SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); }
private static WritableSettingsStore GetWritableSettingsStore(IServiceProvider serviceProvider) { var shellSettingsManager = new ShellSettingsManager(serviceProvider); WritableSettingsStore writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); return writableSettingsStore; }
public PaketSettings(ShellSettingsManager settingsManager) { settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(StoreCollection)) settingsStore.CreateCollection(StoreCollection); }
/// <summary> /// This is used to reset the configuration to its default state /// </summary> /// <param name="deleteConfigurationFile">True to delete the configuration settings collection if it exists, /// false to just set the default values</param> public void ResetConfiguration(bool deleteConfigurationFile) { EnableExtendedXmlCommentsCompletion = EnableGoToDefinition = true; EnableGoToDefinitionInCRef = DefaultEnableGoToDefinitionInCRef; ShellSettingsManager settingsManager = new ShellSettingsManager(_serviceProvider); WritableSettingsStore settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (deleteConfigurationFile && settingsStore.CollectionExists(CollectionPath)) settingsStore.DeleteCollection(CollectionPath); }