Beispiel #1
0
        internal static bool ConvertException(System.Runtime.InteropServices.COMException e, out Exception uiaException)
        {
            bool handled = true;
            switch (e.ErrorCode)
            {
                case UiaCoreIds.UIA_E_ELEMENTNOTAVAILABLE:
                    uiaException = new ElementNotAvailableException(e);
                    break;

                case UiaCoreIds.UIA_E_ELEMENTNOTENABLED:
                    uiaException = new ElementNotEnabledException(e);
                    break;

                case UiaCoreIds.UIA_E_NOCLICKABLEPOINT:
                    uiaException = new NoClickablePointException(e);
                    break;

                case UiaCoreIds.UIA_E_PROXYASSEMBLYNOTLOADED:
                    uiaException = new ProxyAssemblyNotLoadedException(e);
                    break;

                default:
                    uiaException = null;
                    handled = false;
                    break;
            }
            return handled;
        }
Beispiel #2
0
        public static bool ConvertException(COMException e, out Exception newException)
        {
            var flag = true;

            switch (e.HResult)
            {
            case -2147220992:
                newException = new ElementNotEnabledException(innerException: e);
                break;

            case -2147220991:
                newException = new ElementNotAvailableException(innerException: e);
                break;

            case -2147220990:
                newException = new NoClickablePointException(innerException: e);
                break;

            case -2147220989:
                newException = new ProxyAssemblyNotLoadedException(innerException: e);
                break;

            default:
                newException = null;
                flag         = false;
                break;
            }

            return(flag);
        }