Exemplo n.º 1
0
        /// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
        internal static Window Create(AutomationElement element, InitializeOption option, WindowSession windowSession)
        {
            ISpecializedWindowFactory specializedWindowFactory = SpecializedWindowFactories.Find(factory => factory.DoesSpecializeInThis(element));

            if (specializedWindowFactory != null)
            {
                return(specializedWindowFactory.Create(element, option, windowSession));
            }

            var windowsFramework = WindowsFrameworkExtensions.FromFrameworkId(element.Properties.FrameworkId);

            if (windowsFramework == WindowsFramework.WinForms)
            {
                return(new WinFormWindow(element, option, windowSession));
            }
            if (windowsFramework == WindowsFramework.Wpf)
            {
                return(new WPFWindow(element, WindowFactory.Desktop, option, windowSession));
            }
            if (windowsFramework == WindowsFramework.Win32)
            {
                return(new Win32Window(element, WindowFactory.Desktop, option, windowSession));
            }
            throw new UIItemSearchException(string.Format("{0} is not supported yet.", windowsFramework));
        }
Exemplo n.º 2
0
 public FrameworkIdAttribute(string id)
 {
     framework = WindowsFrameworkExtensions.FromFrameworkId(id);
 }