Beispiel #1
0
        /// <summary>
        /// Displays a settings dialog for a project.
        /// </summary>
        /// <param name="settings">The settings manager.</param>
        /// <param name="pages">The list of pages to display on the settings dialog.</param>
        /// <param name="id">A unique identifier string for the property page group.</param>
        /// <returns>Returns true if at least one settings change was made.</returns>
        internal bool ShowProjectSettings(
            WritableSettings settings,
            IList<IPropertyControlPage> pages,
            string id)
        {
            Param.AssertNotNull(settings, "settings");
            Param.AssertNotNull(pages, "pages");
            Param.AssertValidString(id, "id");

            // Create the properties dialog object.
            using (PropertyDialog properties = new PropertyDialog(pages, settings, id, this, null))
            {
                string styleCopTitleText = settings.DefaultSettings ? Strings.SettingsDialogTitleDefault : Strings.SettingsDialogTitleLocal;

                styleCopTitleText = string.Format(styleCopTitleText, this.VersionNumberMajorMinor + " (" + this.VersionNumberFull + ")");

                // Set the dialog title.
                properties.Text = string.Format(Strings.SettingsDialogTitleFormat, styleCopTitleText, settings.Location);

                // Make sure that we're not running in a non-UI mode.
                if (!this.displayUI)
                {
                    throw new InvalidOperationException(Strings.CannotDisplaySettingsInNonUIMode);
                }

                // Show the dialog.
                properties.ShowDialog();

                // Always fire the event regardless of whether any settings were changed. This ensures
                // that everything is always updated properly when settings change.
                this.OnProjectSettingsChanged(new EventArgs());

                // Return true if one or more properties were changed.
                return properties.SettingsChanged;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Displays a settings dialog for a project.
        /// </summary>
        /// <param name="settings">The settings manager.</param>
        /// <param name="pages">The list of pages to display on the settings dialog.</param>
        /// <param name="caption">The caption for the dialog.</param>
        /// <param name="id">A unique identifier string for the property page group.</param>
        /// <returns>Returns true if at least one settings change was made.</returns>
        internal bool ShowProjectSettings(
            WritableSettings settings,
            IList<IPropertyControlPage> pages,
            string caption,
            string id)
        {
            Param.AssertNotNull(settings, "settings");
            Param.AssertNotNull(pages, "pages");
            Param.AssertValidString(caption, "caption");
            Param.AssertValidString(id, "id");

            // Create the properties dialog object.
            using (PropertyDialog properties = new PropertyDialog(pages, settings, id, this, null))
            {
                // Set the dialog title.
                properties.Text = caption;

                // Make sure that we're not running in a non-UI mode.
                if (!this.displayUI)
                {
                    throw new InvalidOperationException(Strings.CannotDisplaySettingsInNonUIMode);
                }

                // Show the dialog.
                properties.ShowDialog();

                // Always fire the event regardless of whether any settings were changed. This ensures
                // that everything is always updated properly when settings change.
                this.OnProjectSettingsChanged(new EventArgs());

                // Return true if one or more properties were changed.
                return properties.SettingsChanged;
            }
        }