예제 #1
0
        private int GetTabIndexToActivate(string tabsUrl)

        {
            AccessibleObjectFromWindow(GetDirectUIHWND(_hWnd), OBJID.OBJID_WINDOW, ref _accessible);

            CheckForAccessible();

            var index = 0;

            var ieDirectUIHWND = new TabActivator(_hWnd);

            foreach (var accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)
                {
                    foreach (var tab in child.Children)
                    {
                        var tabUrl = tab.LocationUrl;

                        if (!string.IsNullOrEmpty(tabUrl))
                        {
                            if (tab.LocationUrl.Contains(tabsUrl))
                            {
                                return(index);
                            }
                        }
                        index++;
                    }
                }
            }
            return(-1);
        }
예제 #2
0
        internal void ActivateByTabsUrl(string tabsUrl)
        {
            var tabIndexToActivate = GetTabIndexToActivate(tabsUrl);

            AccessibleObjectFromWindow(GetDirectUIHWND(_hWnd), OBJID.OBJID_WINDOW, ref _accessible);

            CheckForAccessible();

            var index = 0;

            var ieDirectUIHWND = new TabActivator(_hWnd);

            foreach (var accessor in ieDirectUIHWND.Children)
            {
                foreach (var child in accessor.Children)

                {
                    foreach (var tab in child.Children)

                    {
                        if (tabIndexToActivate >= child.ChildCount - 1)
                        {
                            return;
                        }



                        if (index == tabIndexToActivate)

                        {
                            tab.ActivateTab();

                            return;
                        }



                        index++;
                    }
                }
            }
        }