public AvaloniaVSSettings(SVsServiceProvider vsServiceProvider)
        {
            var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);

            _settings = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            Load();
        }
Пример #2
0
        public PackageSettings([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
        {
            var sm = new ShellSettingsManager(serviceProvider);

            settingsStore = new SettingsStore(sm.GetWritableSettingsStore(SettingsScope.UserSettings), Info.ApplicationInfo.ApplicationSafeName);
            LoadSettings();
        }
Пример #3
0
        /// <summary>
        /// This is used to save the MEF provider configuration settings
        /// </summary>
        /// <remarks>The settings are saved to the Visual Studio user settings store</remarks>
        public bool SaveConfiguration()
        {
            bool success = false;

            try
            {
                var settingsManager = new ShellSettingsManager(serviceProvider);
                var 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, "EnableCtrlClickGoToDefinition",
                                         EnableCtrlClickGoToDefinition);
                settingsStore.SetBoolean(CollectionPath, "EnableGoToDefinitionInCRef", EnableGoToDefinitionInCRef);
                success = true;
            }
            catch (Exception ex)
            {
                // Ignore exceptions
                System.Diagnostics.Debug.WriteLine(ex);
            }

            return(success);
        }
Пример #4
0
        public void SaveSettings()
        {
            QtVSIPSettings.SaveMocDirectory(newMocDir);
            QtVSIPSettings.SaveMocOptions(newMocOptions);
            QtVSIPSettings.SaveUicDirectory(newUicDir);
            QtVSIPSettings.SaveRccDirectory(newRccDir);
            QtVSIPSettings.SaveLUpdateOnBuild(newLUpdateOnBuild);
            QtVSIPSettings.SaveLUpdateOptions(newLUpdateOptions);
            QtVSIPSettings.SaveLReleaseOptions(newLReleaseOptions);
            QtVSIPSettings.SaveAskBeforeCheckoutFile(newAskBeforeCheckoutFile);
            QtVSIPSettings.SaveDisableCheckoutFiles(newDisableCheckoutFiles);
            QtVSIPSettings.SaveDisableAutoMocStepsUpdate(newDisableAutoMOCStepsUpdate);

            var settingsManager = new ShellSettingsManager(Vsix.Instance);
            var store           = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

#if VS2013
            store.CreateCollection(Statics.QmlClassifierPath);
            store.SetBoolean(Statics.QmlClassifierPath, Statics.QmlClassifierKey,
                             EnableQmlClassifier);
#else
            store.CreateCollection(Statics.QmlTextMatePath);
            store.SetBoolean(Statics.QmlTextMatePath, Statics.QmlTextMateKey, EnableQmlTextMate);
#endif
        }
Пример #5
0
        public SettingStoreProvider(string collection)
        {
            this.collection = collection;
            SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);

            userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
        }
Пример #6
0
        /// <summary>
        /// Saves the properties to the registry asyncronously.
        /// </summary>
        public virtual async Task SaveAsync()
        {
            ShellSettingsManager manager = await _settingsManager.GetValueAsync();

            WritableSettingsStore settingsStore = manager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!settingsStore.CollectionExists(CollectionName))
            {
                settingsStore.CreateCollection(CollectionName);
            }

            foreach (PropertyInfo property in GetOptionProperties())
            {
                var output = SerializeValue(property.GetValue(this));
                settingsStore.SetString(CollectionName, property.Name, output);
            }

            T liveModel = await GetLiveInstanceAsync();

            if (this != liveModel)
            {
                await liveModel.LoadAsync();
            }

            Saved?.Invoke(this, liveModel);
        }
Пример #7
0
        public FormsPlayerViewModel([Import(typeof(SVsServiceProvider))] IServiceProvider services)
        {
            ConnectCommand        = new DelegateCommand(Connect, () => !isConnected);
            DisconnectCommand     = new DelegateCommand(Disconnect, () => isConnected);
            events                = services.GetService <DTE>().Events.DocumentEvents;
            events.DocumentSaved += document => Publish(document.FullName);

            var manager = new ShellSettingsManager(services);

            settings = manager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!settings.CollectionExists(SettingsPath))
            {
                settings.CreateCollection(SettingsPath);
            }
            if (settings.PropertyExists(SettingsPath, SettingsKey))
            {
                SessionId = settings.GetString(SettingsPath, SettingsKey, "");
            }

            if (string.IsNullOrEmpty(SessionId))
            {
                // Initialize SessionId from MAC address.
                var mac = NetworkInterface.GetAllNetworkInterfaces()
                          .Where(nic => nic.NetworkInterfaceType != NetworkInterfaceType.Loopback)
                          .Select(nic => nic.GetPhysicalAddress().ToString())
                          .First();

                SessionId = NaiveBijective.Encode(NaiveBijective.Decode(mac));
            }

            TaskScheduler.UnobservedTaskException += OnTaskException;
        }
Пример #8
0
        public ConfiguredSettings(IServiceProvider vsServiceProvider)
        {
            try
            {
                var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);
                this.store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

                if (this.store.PropertyExists(SettingCollectionName, nameof(this.ActualSettings)))
                {
                    var settingsString = this.store.GetString(SettingCollectionName, nameof(this.ActualSettings));

                    this.ActualSettings = DeserializeOrDefault(settingsString);

                    if ((this.ActualSettings.FormatVersion == null ||
                         this.ActualSettings.FormatVersion != Settings.CurrentFormatVersion) &&
                        (configurationErrorReported == false))
                    {
                        configurationErrorReported = true;

                        // `RecordError` may query settings and a problem with settings is why we may be here.
                        SharedRapidXamlPackage.Logger?.RecordError(StringRes.Error_OutdatedConfigurationDetected2, force: true);
                        SharedRapidXamlPackage.Logger?.RecordGeneralError(StringRes.Error_OutdatedConfigurationDetected2);
                    }
                }
                else
                {
                    this.ActualSettings = GetDefaultSettings();
                }
            }
            catch (Exception exc)
            {
                SharedRapidXamlPackage.Logger?.RecordException(exc);
            }
        }
Пример #9
0
        /// <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()
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this));
            base.Initialize();

            var settingsManager = new ShellSettingsManager(this);

            _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            _dte = GetGlobalService(typeof(EnvDTE.DTE)) as DTE2;
            var buildPane = GetBuildPane();

            // Add our command handlers for menu (commands must exist in the .vsct file)
            _onBuildCommand = new OnBuildCommand(_dte, buildPane, _settingsStore, VsOnBuildextensionCollectionPath);

            // Add our command handlers for menu (commands must exist in the .vsct file)
            var mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                // Create the command for the menu item.
                var menuCommandId = new CommandID(GuidList.guidVSOnBuildExtensionCmdSet, (int)PkgCmdIDList.cmdidIISReset);
                var menuItem      = new MenuCommand(_onBuildCommand.MenuItemCallback, menuCommandId);
                _onBuildCommand.ManageMenuItem(menuItem);
                mcs.AddCommand(menuItem);
            }
        }
Пример #10
0
        public SettingsManager(Package settingProvider)
        {
            ShellSettingsManager settingsManager = new ShellSettingsManager(settingProvider);

            _settings = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            LoadSettings();
        }
        public UaBrowserViewModel(Microsoft.VisualStudio.Shell.SVsServiceProvider vsServiceProvider)
        {
            this.cts   = new CancellationTokenSource();
            this.@lock = new SemaphoreSlim(1);

            // describe self.
            this.localDescription = new ApplicationDescription()
            {
                ApplicationName = "Workstation.UaBrowser",
                ApplicationUri  = $"urn:{System.Net.Dns.GetHostName()}:Workstation.UaBrowser",
                ApplicationType = ApplicationType.Client
            };

            this.BrowseStopCommand    = new DelegateCommand(this.BrowseStop);
            this.SaveSettingsCommand  = new DelegateCommand(this.SaveSettings);
            this.ResetSettingsCommand = new DelegateCommand(this.ResetSettings);
            this.NamespaceItems       = new ObservableCollection <ReferenceDescriptionViewModel>();
            this.ide = (EnvDTE.DTE)vsServiceProvider.GetService(typeof(EnvDTE.DTE));
            var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);

            this.store = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            this.LoadSettings();
            this.LoadHistory();
            this.CertificateStore = new DirectoryStore(Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Workstation.UaBrowser\pki"));
        }
Пример #12
0
        public override void SaveSettingsToStorage()
        {
            var settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);
            var settingsStore   = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!settingsStore.CollectionExists(Vsix.Code))
            {
                settingsStore.CreateCollection(Vsix.Code);
            }

            foreach (var property in GetType().GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance))
            {
                try
                {
                    var objValue = property.GetValue(this);
                    var strValue = JsonConvert.SerializeObject(objValue);

                    settingsStore.SetString(Vsix.Code, property.Name, strValue);
                }
                catch (Exception exception)
                {
                    Logger.Log($"Failed to save '{property.Name}' setting", exception);
                }
            }
        }
Пример #13
0
        /// <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 <SolutionBuilderToolWindow>(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 <SolutionBuilderToolWindow>();
            }
        }
Пример #14
0
        public AuthenticationViewModel(IJiraToolWindowNavigatorViewModel parent,
                                       IOAuthService oAuthService,
                                       IBasicAuthenticationService basicService,
                                       IUserService userService)
        {
            this._parent = parent;

            this._baseUrl      = UserSettingsHelper.ReadStringFromUserSettings("JiraBaseUrl");
            this._baseUrlBasic = UserSettingsHelper.ReadStringFromUserSettings("JiraBaseUrl");
            this._username     = UserSettingsHelper.ReadStringFromUserSettings("JiraUsername");

            this._oAuthService = oAuthService;
            this._basicService = basicService;
            this._userService  = userService;

            SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);

            this._userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            this.SignInOAuthCommand     = new DelegateCommand(SignInOAuth);
            this.SignInBasicCommand     = new DelegateCommand(SignInBasic);
            this.HowToSetupOAuthCommand = new DelegateCommand(HowToSetupOAuth);

            SetPanelTitles();
        }
        public void LoadFilterStoreData()
        {
            SettingsManager       settingsManager = new ShellSettingsManager(LogcatOutputToolWindowCommand.Instance.ServiceProvider);
            WritableSettingsStore settingsStore   = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (settingsStore.CollectionExists(StoreFilterCollectionName))
            {
                int count = settingsStore.GetSubCollectionCount(StoreFilterCollectionName);
                IEnumerable <string> filter_name_list = settingsStore.GetSubCollectionNames(LogcatOutputToolWindowControl.StoreFilterCollectionName);
                if (filter_name_list == null)
                {
                    return;
                }
                foreach (string name in filter_name_list)
                {
                    string filter_sub_collection = StoreFilterCollectionName
                                                   + "\\" + name;
                    string tag = settingsStore.GetString(filter_sub_collection,
                                                         LogcatOutputToolWindowControl.StorePropertyFilterTagName, "");
                    int pid = settingsStore.GetInt32(filter_sub_collection,
                                                     LogcatOutputToolWindowControl.StorePropertyFilterPidName, 0);
                    string msg = settingsStore.GetString(filter_sub_collection,
                                                         LogcatOutputToolWindowControl.StorePropertyFilterMsgName, "");
                    string pkg = settingsStore.GetString(filter_sub_collection,
                                                         LogcatOutputToolWindowControl.StorePropertyFilterPackageName, "");
                    int level = settingsStore.GetInt32(filter_sub_collection,
                                                       LogcatOutputToolWindowControl.StorePropertyFilterLevelName, 0);
                    AddFilterItem(name, tag, pid, msg, pkg,
                                  (LogcatOutputToolWindowControl.LogcatItem.Level)level, false);
                }
            }
        }
Пример #16
0
        private void SaveGroupsForSolution(string solutionName = null, IList <DocumentGroup> groups = null)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (solutionName == null)
            {
                solutionName = SolutionName;
            }
            if (string.IsNullOrWhiteSpace(solutionName))
            {
                return;
            }

            if (groups == null)
            {
                groups = Groups;
            }

            var settingsMgr = new ShellSettingsManager(ServiceProvider);
            var store       = settingsMgr.GetWritableSettingsStore(SettingsScope.UserSettings);

            string projectKeyHash   = GetHashString(solutionName);
            string projectGroupsKey = string.Format(ProjectGroupsKeyPlaceholder, projectKeyHash);

            if (store.CollectionExists(projectGroupsKey))
            {
                store.DeleteCollection(projectGroupsKey);
            }
            store.CreateCollection(projectGroupsKey);

            foreach (DocumentGroup group in groups)
            {
                var serializedGroup = JsonConvert.SerializeObject(group);
                store.SetString(projectGroupsKey, group.Name, serializedGroup);
            }
        }
        private WritableSettingsStore GetSettings()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);

            return(settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings));
        }
Пример #18
0
        public SettingsRepository(IServiceProvider vsServiceProvider)
        {
            _vsServiceProvider = vsServiceProvider;
            var ssm = new ShellSettingsManager(_vsServiceProvider);

            _writableSettingsStore = ssm.GetWritableSettingsStore(SettingsScope.UserSettings);
        }
Пример #19
0
        public Options(SVsServiceProvider vsServiceProvider)
        {
            var shellSettingsManager = new ShellSettingsManager(vsServiceProvider);

            _writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            LoadSettings();
        }
Пример #20
0
        /// <summary>
        /// Saves the properties to the registry asyncronously.
        /// </summary>
        public virtual async Task SaveAsync()
        {
            ShellSettingsManager manager = await _settingsManager.GetValueAsync().ConfigureAwait(true);

            WritableSettingsStore settingsStore = manager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!settingsStore.CollectionExists(CollectionName))
            {
                settingsStore.CreateCollection(CollectionName);
            }

#if DEBUG_OPTION_VALUES_LOAD_SAVE
            Debug.WriteLine($"SaveAsync<{typeof(T).Name}>()");
#endif
            var propertiesToSerialize = GetOptionProperties();
            foreach (PropertyInfo property in propertiesToSerialize)
            {
                string output = SerializeValue(property.GetValue(this));
#if DEBUG_OPTION_VALUES_LOAD_SAVE
                Debug.WriteLine($"{property.Name} = {property.GetValue(this)}");
#endif
                settingsStore.SetString(CollectionName, property.Name, output);
            }
#if DEBUG_OPTION_VALUES_LOAD_SAVE
            Debug.WriteLine($"SaveAsync<{typeof(T).Name}>() finished =================================");
#endif
        }
Пример #21
0
        /// <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>
        /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param>
        /// <param name="progress">A provider for progress updates.</param>
        /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
        protected override async Task InitializeAsync(CancellationToken cancellationToken,
                                                      IProgress <ServiceProgressData> progress)
        {
            // When initialized asynchronously, the current thread may be a background thread at this point.
            // Do any initialization that requires the UI thread after switching to the UI thread.
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            var settingsManager       = new ShellSettingsManager(this);
            var writableSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            var settingsStore         = new SettingsService(writableSettingsStore);

            var dte = (DTE) await GetServiceAsync(typeof(SDTE));

            var applicationEvents = dte.Application.Events;
            var documentEvents    = applicationEvents.DocumentEvents;
            var devEnvEvents      = dte.Events.DTEEvents;
            var enviromentEvents  = new WindowsEnvironmentService(this, documentEvents, applicationEvents.SolutionEvents,
                                                                  dte.Application.Solution, devEnvEvents);

            var dependencyContainer = new DependencyContainer(new DependenciesRegistrar());
            var guiPresenter        = new GuiService(this, dependencyContainer);

            await EnableExtensionCommand.InitializeAsync(this);

            await DisableExtensionCommand.InitializeAsync(this);

            var commandsDictionary = new Dictionary <HotReloadCommands, IEnvironmentCommand>
            {
                { HotReloadCommands.Enable, EnableExtensionCommand.Instance },
                { HotReloadCommands.Disable, DisableExtensionCommand.Instance }
            };

            Main.Init(enviromentEvents, commandsDictionary, guiPresenter, settingsStore);
        }
        private WritableSettingsStore GetSettingsStore()
        {
            SettingsManager       settingsManager   = new ShellSettingsManager(ConfigCommand.ServiceProviderForWindow);
            WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            return(userSettingsStore);
        }
Пример #23
0
        private static WritableSettingsStore GetWritableSettingsStore(IServiceProvider serviceProvider)
        {
            var shellSettingsManager  = new ShellSettingsManager(serviceProvider);
            var writableSettingsStore = shellSettingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            return(writableSettingsStore);
        }
Пример #24
0
        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);
        }
Пример #25
0
        private void LoadSettings()
        {
            SettingsManager       settingsManager            = new ShellSettingsManager(this);
            WritableSettingsStore configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            _settings = new Settings(configurationSettingsStore);
        }
Пример #26
0
        private void RaiseParametersChanged(Parameter param)
        {
            if (ParametersChanged != null)
            {
                ParametersChanged(this, new ParametersEnventArgs(param));
            }

            if (param == Parameter.Port || param == Parameter.DisableESMTP)
            {
                SettingsManager       settingsManager            = new ShellSettingsManager(VMSTPSettingsStore.ServiceProvider);
                WritableSettingsStore configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

                bool collectionExists = configurationSettingsStore.CollectionExists(VMSTPSettingsStore.Collection);
                if (!collectionExists)
                {
                    configurationSettingsStore.CreateCollection(VMSTPSettingsStore.Collection);
                }

                if (collectionExists || configurationSettingsStore.CollectionExists(VMSTPSettingsStore.Collection))
                {
                    configurationSettingsStore.SetBoolean(VMSTPSettingsStore.Collection, "DisableESMTP", DisableESMTP);
                    configurationSettingsStore.SetInt32(VMSTPSettingsStore.Collection, "Port", Port);
                }
            }
        }
Пример #27
0
        public Settings(IServiceProvider provider)
        {
            SettingsManager settingsManager = new ShellSettingsManager(provider);

            _settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            if (!_settingsStore.CollectionExists("DebugAttachManagerProcesses"))
            {
                return;
            }
            IEnumerable <string> services = _settingsStore.GetSubCollectionNames("DebugAttachManagerProcesses");

            foreach (var s in services)
            {
                var p = new StoredProcessInfo
                {
                    ProcessName = _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "ProcessName"),
                    Title       = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "Title") ?
                                  _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "Title") : null,
                    RemoteServerName = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemoteServerName") ?
                                       _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "RemoteServerName") : null,
                    RemotePortNumber = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") ?
                                       _settingsStore.GetInt64("DebugAttachManagerProcesses\\" + s, "RemotePortNumber") : (long?)null,
                    Selected  = _settingsStore.GetBoolean("DebugAttachManagerProcesses\\" + s, "Selected"),
                    DebugMode = _settingsStore.PropertyExists("DebugAttachManagerProcesses\\" + s, "DebugMode") ?
                                _settingsStore.GetString("DebugAttachManagerProcesses\\" + s, "DebugMode") : null
                };
                Processes.Add(p.Hash, p);
            }

            if (_settingsStore.PropertyExists("DebugAttachManagerProcesses", "RemoteServer"))
            {
                RemoteServer = _settingsStore.GetString("DebugAttachManagerProcesses", "RemoteServer");
            }
        }
        void LoadSettings()
        {
            SettingsManager       settingsManager            = new ShellSettingsManager(LogcatOutputToolWindowCommand.Instance.ServiceProvider);
            WritableSettingsStore configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            string adb_path  = configurationSettingsStore.GetString(StoreCategoryName, StorePropertyAdbPathName, "");
            uint   log_limit = configurationSettingsStore.GetUInt32(StoreCategoryName, StorePropertyLogsLimitName, 20000);
            bool   is_auto   = configurationSettingsStore.GetBoolean(StoreCategoryName, StorePropertyAutoScrollName, false);

            LogLimitCount  = log_limit;
            adb.AdbExePath = adb_path;
            IsAutoScroll   = is_auto;
            ColumnWidth[0] = configurationSettingsStore.GetUInt32(StoreCategoryName, StorePropertyLevelWidthName, 60);
            ColumnWidth[1] = configurationSettingsStore.GetUInt32(StoreCategoryName, StorePropertyTimeWidthName, 120);
            ColumnWidth[2] = configurationSettingsStore.GetUInt32(StoreCategoryName, StorePropertyPidWidthName, 60);
            ColumnWidth[3] = configurationSettingsStore.GetUInt32(StoreCategoryName, StorePropertyTagWidthName, 120);
            ColumnWidth[4] = configurationSettingsStore.GetUInt32(StoreCategoryName, StorePropertyTextWidthName, 600);

            if (IsAutoScroll)
            {
                Dispatcher.InvokeAsync(() => { AutoScrollLabel.Content = "Auto Scroll On"; });
            }
            else
            {
                Dispatcher.InvokeAsync(() => { AutoScrollLabel.Content = "Auto Scroll Off"; });
            }
        }
Пример #29
0
        static StaticBoilerplateSettings()
        {
            SettingsManager settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider);

            Store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
            Store.CreateCollection(CollectionPath);

            if (Store.PropertyExists(CollectionPath, TestProjectsKey))
            {
                string dictionaryString = Store.GetString(CollectionPath, TestProjectsKey);

                if (string.IsNullOrEmpty(dictionaryString))
                {
                    TestProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                }
                else
                {
                    TestProjectsDictionary = new Dictionary <string, string>(JsonConvert.DeserializeObject <Dictionary <string, string> >(dictionaryString), StringComparer.OrdinalIgnoreCase);
                }
            }
            else
            {
                TestProjectsDictionary = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            }
        }
        private void GitHubDialogWindowControl_OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            if ((bool)args.NewValue == false)
            {
                return;
            }

            SettingsManager       settingsManager   = new ShellSettingsManager(ServiceProvider.GlobalProvider);
            WritableSettingsStore userSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            if (!userSettingsStore.CollectionExists("XamlToolkit"))
            {
                return;
            }

            var directory = userSettingsStore.GetString("XamlToolkit", "Directory");

            if (string.IsNullOrWhiteSpace(directory))
            {
                return;
            }

            try
            {
                GitHubDialogViewModel.UpdateDirectory(directory);
                GitHubDialogViewModel.Run(Path.Combine(directory, AppSettings.Default.ExePath));
                Window.GetWindow(this).Close();
            }
            catch (Exception)
            {
                GitHubDialogViewModel.SaveDirectorySettings("");
            }
        }