GetInvokeMethod() public static method

public static GetInvokeMethod ( IEventReference value ) : IMethodDeclaration
value IEventReference
return IMethodDeclaration
Example #1
0
        public static MethodVisibility GetVisibility(IEventReference value)
        {
            IMethodDeclaration addMethod    = Helper.GetAddMethod(value);
            IMethodDeclaration removeMethod = Helper.GetRemoveMethod(value);
            IMethodDeclaration invokeMethod = Helper.GetInvokeMethod(value);

            if ((addMethod != null) && (removeMethod != null) && (invokeMethod != null))
            {
                if ((addMethod.Visibility == removeMethod.Visibility) && (addMethod.Visibility == invokeMethod.Visibility))
                {
                    return(addMethod.Visibility);
                }
            }
            else if ((addMethod != null) && (removeMethod != null))
            {
                if (addMethod.Visibility == removeMethod.Visibility)
                {
                    return(addMethod.Visibility);
                }
            }
            else if ((addMethod != null) && (invokeMethod != null))
            {
                if (addMethod.Visibility == invokeMethod.Visibility)
                {
                    return(addMethod.Visibility);
                }
            }
            else if ((removeMethod != null) && (invokeMethod != null))
            {
                if (removeMethod.Visibility == invokeMethod.Visibility)
                {
                    return(removeMethod.Visibility);
                }
            }
            else if (addMethod != null)
            {
                return(addMethod.Visibility);
            }
            else if (removeMethod != null)
            {
                return(removeMethod.Visibility);
            }
            else if (invokeMethod != null)
            {
                return(invokeMethod.Visibility);
            }

            return(MethodVisibility.Public);
        }
Example #2
0
        public static bool IsStatic(IEventReference value)
        {
            bool isStatic = false;

            if (Helper.GetAddMethod(value) != null)
            {
                isStatic |= Helper.GetAddMethod(value).Static;
            }

            if (Helper.GetRemoveMethod(value) != null)
            {
                isStatic |= Helper.GetRemoveMethod(value).Static;
            }

            if (Helper.GetInvokeMethod(value) != null)
            {
                isStatic |= Helper.GetInvokeMethod(value).Static;
            }

            return(isStatic);
        }