示例#1
0
        /// <include file='doc\Help.uex' path='docs/doc[@for="Help.MapCommandToHTMLCommand"]/*' />
        /// <devdoc>
        ///     Maps one of the COMMAND_* constants to the HTML 1.0 Help equivalent.
        /// </devdoc>
        /// <internalonly/>
        private static int MapCommandToHTMLCommand(HelpNavigator command, string param, out object htmlParam)
        {
            htmlParam = param;

            if ((string.IsNullOrEmpty(param)) &&
                (command == HelpNavigator.AssociateIndex || command == HelpNavigator.KeywordIndex))
            {
                return(HH_DISPLAY_INDEX);
            }

            switch (command)
            {
            case HelpNavigator.Topic:
                return(HH_DISPLAY_TOPIC);

            case HelpNavigator.TableOfContents:
                return(HH_DISPLAY_TOC);

            case HelpNavigator.Index:
                return(HH_DISPLAY_INDEX);

            case HelpNavigator.Find: {
                NativeMethods.HH_FTS_QUERY ftsQuery = new NativeMethods.HH_FTS_QUERY();
                ftsQuery.pszSearchQuery = param;
                htmlParam = ftsQuery;
                return(HH_DISPLAY_SEARCH);
            }

            case HelpNavigator.TopicId: {
                try {
                    htmlParam = int.Parse(param, CultureInfo.InvariantCulture);
                    return(HH_HELP_CONTEXT);
                }
                catch {
                    // default to just showing the index
                    return(HH_DISPLAY_INDEX);
                }
            }

            case HelpNavigator.KeywordIndex:
            case HelpNavigator.AssociateIndex: {
                NativeMethods.HH_AKLINK alink = new NativeMethods.HH_AKLINK();
                alink.pszKeywords  = param;
                alink.fIndexOnFail = true;
                alink.fReserved    = false;
                htmlParam          = alink;
                return((command == HelpNavigator.KeywordIndex) ? HH_KEYWORD_LOOKUP : HH_ALINK_LOOKUP);
            }

            default:
                return((int)command);
            }
        }
示例#2
0
        /// <include file='doc\Help.uex' path='docs/doc[@for="Help.MapCommandToHTMLCommand"]/*' />
        /// <devdoc>
        ///     Maps one of the COMMAND_* constants to the HTML 1.0 Help equivalent.
        /// </devdoc>
        /// <internalonly/>
        private static int MapCommandToHTMLCommand(HelpNavigator command, string param, out object htmlParam)
        {
            htmlParam = param;

            if ((param == null || param == "") &&
                (command == HelpNavigator.AssociateIndex || command == HelpNavigator.KeywordIndex))
            {
                return(HH_DISPLAY_INDEX);
            }

            switch (command)
            {
            case HelpNavigator.Topic:
                return(HH_DISPLAY_TOPIC);

            case HelpNavigator.TableOfContents:
                return(HH_DISPLAY_TOC);

            case HelpNavigator.Index:
                return(HH_DISPLAY_INDEX);

            case HelpNavigator.Find: {
                NativeMethods.HH_FTS_QUERY ftsQuery = new NativeMethods.HH_FTS_QUERY();
                ftsQuery.pszSearchQuery = param;
                htmlParam = ftsQuery;
                return(HH_DISPLAY_SEARCH);
            }

            case HelpNavigator.KeywordIndex:
            case HelpNavigator.AssociateIndex: {
                NativeMethods.HH_AKLINK alink = new NativeMethods.HH_AKLINK();
                alink.pszKeywords  = param;
                alink.fIndexOnFail = true;
                htmlParam          = alink;
                return((command == HelpNavigator.KeywordIndex) ? HH_KEYWORD_LOOKUP : HH_ALINK_LOOKUP);
            }

            default:
                return((int)command);
            }
        }
 public static extern int HtmlHelp(HandleRef hwndCaller, [MarshalAs(UnmanagedType.LPTStr)] string pszFile, int uCommand, [MarshalAs(UnmanagedType.LPStruct)] NativeMethods.HH_FTS_QUERY dwData);