예제 #1
0
        /// <summary>
        ///     Get a help link (if available) for the specified element.
        /// </summary>
        /// <param name="elementName">
        ///     The element name.
        /// </param>
        /// <returns>
        ///     The element help link, or <c>null</c> if no link is available for it.
        /// </returns>
        public static string HelpLinkForElement(string elementName)
        {
            if (String.IsNullOrWhiteSpace(elementName))
            {
                throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'elementName'.", nameof(elementName));
            }

            string helpKey = elementName;

            if (ElementHelp.TryGetValue(helpKey, out ElementHelp help))
            {
                return(help.HelpLink);
            }

            return(null);
        }
예제 #2
0
        /// <summary>
        ///     Get help content for the specified element.
        /// </summary>
        /// <param name="elementName">
        ///     The element name.
        /// </param>
        /// <returns>
        ///     The element help content, or <c>null</c> if no content is available for it.
        /// </returns>
        public static string ForElement(string elementName)
        {
            if (String.IsNullOrWhiteSpace(elementName))
            {
                throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'elementName'.", nameof(elementName));
            }

            string helpKey = elementName;

            // Prefer new help content (includes links to documentation).
            if (ElementHelp.TryGetValue(helpKey, out ElementHelp elementHelp))
            {
                return(elementHelp.Description);
            }

            // Fall back to existing help content.
            if (Root.TryGetValue(helpKey, out string help))
            {
                return(help);
            }

            return(null);
        }