예제 #1
0
        public UIA3Automation()
            : base(new UIA3PropertyLibrary(), new UIA3EventLibrary(), new UIA3PatternLibrary())
        {
            if (WindowsVersion.IsWindows8_1())
            {
                // Try CUIAutomation8 (Windows 8)
                try
                {
                    this.NativeAutomation = new Interop.UIAutomationClient.CUIAutomation8();
                }
                catch (COMException)
                {
                    // Fall back to CUIAutomation
                    this.NativeAutomation = new Interop.UIAutomationClient.CUIAutomation();
                }
            }
            else
            {
                this.NativeAutomation = new Interop.UIAutomationClient.CUIAutomation();
            }

            this.TreeWalkerFactory = new UIA3TreeWalkerFactory(this);
        }