Example #1
0
        /// <summary>
        /// This method is used to initialize the plug-in at the start of the build process
        /// </summary>
        /// <param name="buildProcess">A reference to the current build process</param>
        /// <param name="configuration">The configuration data that the plug-in should use to initialize itself</param>
        public void Initialize(BuildProcess buildProcess, XPathNavigator configuration)
        {
            builder = buildProcess;

            var metadata = (HelpFileBuilderPlugInExportAttribute)this.GetType().GetCustomAttributes(
                typeof(HelpFileBuilderPlugInExportAttribute), false).First();

            builder.ReportProgress("{0} Version {1}\r\n{2}", metadata.Id, metadata.Version, metadata.Copyright);

            XElement root = XElement.Parse(configuration.OuterXml);

            if (root.IsEmpty)
            {
                throw new BuilderException("WRP0001", "The Wildcard References plug-in has not been configured yet");
            }

            // Load the reference links settings
            referencePaths = new WildcardReferenceSettingsCollection();
            referencePaths.FromXml(buildProcess.CurrentProject, root);

            if (referencePaths.Count == 0)
            {
                throw new BuilderException("WRP0002", "At least one reference path is required for the " +
                                           "Wildcard References plug-in.");
            }
        }
Example #2
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="currentProject">The current project</param>
        /// <param name="currentConfig">The current XML configuration
        /// XML fragment</param>
        public WildcardReferencesConfigDlg(SandcastleProject currentProject, string currentConfig)
        {
            InitializeComponent();
            project = currentProject;

            lnkProjectSite.Links[0].LinkData = "https://GitHub.com/EWSoftware/SHFB";
            lbReferences.DisplayMember       = lbReferences.ValueMember = "ListDescription";

            items = new WildcardReferenceSettingsCollection();

            // Load the current settings
            config = XElement.Parse(currentConfig);

            if (!config.IsEmpty)
            {
                items.FromXml(project, config);
            }

            if (items.Count == 0)
            {
                pgProps.Enabled = btnDelete.Enabled = false;
            }
            else
            {
                // Binding the collection to the list box caused some odd problems with the property grid so
                // we'll add the items to the list box directly.
                foreach (WildcardReferenceSettings rl in items)
                {
                    lbReferences.Items.Add(rl);
                }

                lbReferences.SelectedIndex = 0;
            }
        }