JakeGinnivan/UIAComWrapper — pull request #2 by ivan-danilov (2014-05-01 10:22:48+00:00)
Title: Changed behavior on unknown patterns to allow usage of custom patterns with the wrapper.

Sorry for all-changed diff, I don't know why is this happened - I've only changed one line and haven't changed eols. If you help me with avoiding this - I'd be happy to make it better. Really changed here are lines 173-174.

[I'm working on making custom patterns/custom properties][1] possible for WPF/WinForms, easy to write with AutomationPeers in case of WPF and easy to consume from White or with bare UIAComWrapper. I was able to successfully register new patterns/properties, but UIAComWrapper effectively blocks custom patterns as described below.

Before TryGetPattern was calling WrapObjectAsPattern, which in turn asked Schema for pattern info. Schema is internal and not extensible, hence UIA COM Wrapper effectively can't be used with patterns outside of set of patterns hardcoded in Schema. This changes the behavior: if we don't know how to wrap pattern - just return it as it is and let caller deal with consequences. Actually, it seems fine for custom patterns as author of custom pattern should know what he needs to do in such case.

For custom UIA standalone properties everything is fine, as `WrapObjectAsProperty` at line 182 returns value as it is if it is unknown to schema.

[1]: https://github.com/ivan-danilov/uia-custom-pattern-managed