public override int GetHelpTopic(out string fileName)
            {
                int topic = 0;

                QueryAccessibilityHelpEventHandler handler = (QueryAccessibilityHelpEventHandler)Owner.Events[ToolStripItem.s_queryAccessibilityHelpEvent];

                if (handler != null)
                {
                    QueryAccessibilityHelpEventArgs args = new QueryAccessibilityHelpEventArgs();
                    handler(Owner, args);

                    fileName = args.HelpNamespace;

                    try
                    {
                        topic = int.Parse(args.HelpKeyword, CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                    }

                    return(topic);
                }

                return(base.GetHelpTopic(out fileName));
            }
Ejemplo n.º 2
0
        public void WebBrowserBase_QueryAccessibilityHelp__AddRemove_ThrowsNotSupportedException()
        {
            using var control = new SubWebBrowserBase("8856f961-340a-11d0-a96b-00c04fd705a2");
            QueryAccessibilityHelpEventHandler handler = (sender, e) => { };

            Assert.Throws <NotSupportedException>(() => control.QueryAccessibilityHelp += handler);
            control.QueryAccessibilityHelp -= handler;
        }
Ejemplo n.º 3
0
        public void AxHost_QueryAccessibilityHelp__AddRemove_ThrowsNotSupportedException()
        {
            var control = new SubAxHost("00000000-0000-0000-0000-000000000000");
            QueryAccessibilityHelpEventHandler handler = (sender, e) => { };

            Assert.Throws <NotSupportedException>(() => control.QueryAccessibilityHelp += handler);
            control.QueryAccessibilityHelp -= handler;
        }
Ejemplo n.º 4
0
        private void HandleQueryAccessibilityHelp(object sender, QueryAccessibilityHelpEventArgs e)
        {
            QueryAccessibilityHelpEventHandler handler = (QueryAccessibilityHelpEventHandler)Events[ToolStripItem.EventQueryAccessibilityHelp];

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// queryaccessibilityhelpeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this QueryAccessibilityHelpEventHandler queryaccessibilityhelpeventhandler, Object sender, QueryAccessibilityHelpEventArgs e, AsyncCallback callback)
        {
            if (queryaccessibilityhelpeventhandler == null)
            {
                throw new ArgumentNullException("queryaccessibilityhelpeventhandler");
            }

            return(queryaccessibilityhelpeventhandler.BeginInvoke(sender, e, callback, null));
        }
            public override int GetHelpTopic(out string fileName)
            {
                int topic = 0;

                QueryAccessibilityHelpEventHandler handler = (QueryAccessibilityHelpEventHandler)Owner.Events[ToolStripItem.s_queryAccessibilityHelpEvent];

                if (handler is not null)
                {
                    QueryAccessibilityHelpEventArgs args = new QueryAccessibilityHelpEventArgs();
                    handler(Owner, args);

                    fileName = args.HelpNamespace;

                    int.TryParse(args.HelpKeyword, NumberStyles.Integer, CultureInfo.InvariantCulture, out topic);

                    return(topic);
                }

                return(base.GetHelpTopic(out fileName));
            }