Esempio n. 1
0
        /// <summary>
        /// Launches the <see cref="SettingsManagementComponent"/> or activates it if it's already open.
        /// </summary>
        /// <remarks>
        /// This method first looks for a valid extension of <see cref="SettingsStoreExtensionPoint"/> and
        /// with which to initialize the <see cref="SettingsManagementComponent"/>.  If one is not found,
        /// an instance of <see cref="LocalSettingsStore"/> is instantiated and passed to the
        /// <see cref="SettingsManagementComponent"/>.  The <see cref="LocalSettingsStore"/> allows
        /// the local application settings to be modified, where by default they cannot be.
        /// </remarks>
        public void Activate()
        {
            if (_workspace != null)
            {
                _workspace.Activate();
                return;
            }

            ISettingsStore store;

            try
            {
                store = SettingsStore.Create();
                //If there is a store, and it is not online, then settings can't be edited.
                if (!store.IsOnline)
                {
                    Context.DesktopWindow.ShowMessageBox(SR.MessageSettingsStoreOffline, MessageBoxActions.Ok);
                    return;
                }
            }
            catch (NotSupportedException)
            {
                // There is no central settings store; all settings will be treated as though they were local.
                store = new NullSettingsStore();
            }

            _workspace = ApplicationComponent.LaunchAsWorkspace(
                this.Context.DesktopWindow,
                new SettingsManagementComponent(store),
                SR.TitleSettingsEditor,
                "Settings Management");

            _workspace.Closed += OnWorkspaceClosed;
        }
Esempio n. 2
0
        /// <summary>
        /// Launches the <see cref="SettingsManagementComponent"/> or activates it if it's already open.
        /// </summary>
        /// <remarks>
        /// This method first looks for a valid extension of <see cref="SettingsStoreExtensionPoint"/> and
        /// with which to initialize the <see cref="SettingsManagementComponent"/>.  If one is not found,
        /// an instance of <see cref="LocalSettingsStore"/> is instantiated and passed to the
        /// <see cref="SettingsManagementComponent"/>.  The <see cref="LocalSettingsStore"/> allows
        /// the local application settings to be modified, where by default they cannot be.
        /// </remarks>
        public void Activate()
        {
            if (_workspace != null)
            {
                _workspace.Activate();
                return;
            }

            ISettingsStore store;

            try
            {
                store = SettingsStore.Create();
            }
            catch (NotSupportedException)
            {
                // there is no central settings store
                store = new NullSettingsStore();
            }

            if (!store.IsOnline)
            {
                Context.DesktopWindow.ShowMessageBox(SR.MessageSettingsStoreOffline, MessageBoxActions.Ok);
                return;
            }

            _workspace = ApplicationComponent.LaunchAsWorkspace(
                this.Context.DesktopWindow,
                new SettingsManagementComponent(store),
                SR.TitleSettingsEditor,
                "Settings Management");

            _workspace.Closed += OnWorkspaceClosed;
        }