Example #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="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;
            }
        }
Example #2
0
 internal bool ShowProjectSettings(WritableSettings settings, IList<IPropertyControlPage> pages, string caption, string id)
 {
     PropertyDialog dialog = new PropertyDialog(pages, settings, id, this, null, new object[0]);
     dialog.Text = caption;
     if (!this.displayUI)
     {
         throw new InvalidOperationException(Strings.CannotDisplaySettingsInNonUIMode);
     }
     dialog.ShowDialog();
     this.OnProjectSettingsChanged(new EventArgs());
     return dialog.SettingsChanged;
 }