Пример #1
0
        private static int MapCommandToHTMLCommand(HelpNavigator command, string param, out object htmlParam)
        {
            htmlParam = param;
            if (string.IsNullOrEmpty(param) && ((command == HelpNavigator.AssociateIndex) || (command == HelpNavigator.KeywordIndex)))
            {
                return(2);
            }
            switch (command)
            {
            case HelpNavigator.Topic:
                return(0);

            case HelpNavigator.TableOfContents:
                return(1);

            case HelpNavigator.Index:
                return(2);

            case HelpNavigator.Find:
            {
                System.Windows.Forms.NativeMethods.HH_FTS_QUERY hh_fts_query = new System.Windows.Forms.NativeMethods.HH_FTS_QUERY {
                    pszSearchQuery = param
                };
                htmlParam = hh_fts_query;
                return(3);
            }

            case HelpNavigator.AssociateIndex:
            case HelpNavigator.KeywordIndex:
                break;

            case HelpNavigator.TopicId:
                try
                {
                    htmlParam = int.Parse(param, CultureInfo.InvariantCulture);
                    return(15);
                }
                catch
                {
                    return(2);
                }
                break;

            default:
                return((int)command);
            }
            System.Windows.Forms.NativeMethods.HH_AKLINK hh_aklink = new System.Windows.Forms.NativeMethods.HH_AKLINK {
                pszKeywords  = param,
                fIndexOnFail = true,
                fReserved    = false
            };
            htmlParam = hh_aklink;
            if (command != HelpNavigator.KeywordIndex)
            {
                return(0x13);
            }
            return(13);
        }
 public static extern int HtmlHelp(HandleRef hwndCaller, [MarshalAs(UnmanagedType.LPTStr)] string pszFile, int uCommand, [MarshalAs(UnmanagedType.LPStruct)] System.Windows.Forms.NativeMethods.HH_FTS_QUERY dwData);
        private static int MapCommandToHTMLCommand(HelpNavigator command, string param, out object htmlParam)
        {
            htmlParam = param;
            if (string.IsNullOrEmpty(param) && ((command == HelpNavigator.AssociateIndex) || (command == HelpNavigator.KeywordIndex)))
            {
                return 2;
            }
            switch (command)
            {
                case HelpNavigator.Topic:
                    return 0;

                case HelpNavigator.TableOfContents:
                    return 1;

                case HelpNavigator.Index:
                    return 2;

                case HelpNavigator.Find:
                {
                    System.Windows.Forms.NativeMethods.HH_FTS_QUERY hh_fts_query = new System.Windows.Forms.NativeMethods.HH_FTS_QUERY {
                        pszSearchQuery = param
                    };
                    htmlParam = hh_fts_query;
                    return 3;
                }
                case HelpNavigator.AssociateIndex:
                case HelpNavigator.KeywordIndex:
                    break;

                case HelpNavigator.TopicId:
                    try
                    {
                        htmlParam = int.Parse(param, CultureInfo.InvariantCulture);
                        return 15;
                    }
                    catch
                    {
                        return 2;
                    }
                    break;

                default:
                    return (int) command;
            }
            System.Windows.Forms.NativeMethods.HH_AKLINK hh_aklink = new System.Windows.Forms.NativeMethods.HH_AKLINK {
                pszKeywords = param,
                fIndexOnFail = true,
                fReserved = false
            };
            htmlParam = hh_aklink;
            if (command != HelpNavigator.KeywordIndex)
            {
                return 0x13;
            }
            return 13;
        }